From a9c6227da4da2a81aaa4d3309f8d6b17b098e24e Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 7 Sep 2021 18:54:13 +0530 Subject: [PATCH] worker error improved --- apps/remix-ide-e2e/src/commands/noWorkerErrorFor.ts | 2 +- apps/remix-ide/src/app/tabs/compile-tab.js | 2 +- libs/remix-solidity/src/compiler/compiler.ts | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/noWorkerErrorFor.ts b/apps/remix-ide-e2e/src/commands/noWorkerErrorFor.ts index 7a916f34b7..c9364c2552 100644 --- a/apps/remix-ide-e2e/src/commands/noWorkerErrorFor.ts +++ b/apps/remix-ide-e2e/src/commands/noWorkerErrorFor.ts @@ -18,7 +18,7 @@ function noWorkerErrorFor (browser: NightwatchBrowser, version: string, callback .setSolidityCompilerVersion(version) .click('*[data-id="compilerContainerCompileBtn"]') .waitForElementPresent('*[data-id="compilationFinishedWith_' + version + '"]', 60000) - .notContainsText('*[data-id="compiledErrors"]', 'worker error:undefined') + .notContainsText('*[data-id="compiledErrors"]', `Worker error: Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://binaries.soliditylang.org/wasm/${version}' failed to load.`) .notContainsText('*[data-id="compiledErrors"]', 'Uncaught RangeError: Maximum call stack size exceeded') .notContainsText('*[data-id="compiledErrors"]', 'RangeError: Maximum call stack size exceeded') .perform(() => { diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index de0415dcb1..2276d759e1 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -162,7 +162,7 @@ class CompileTab extends ViewPlugin { ) }) } else { - const count = (data.errors ? data.errors.filter(error => error.severity === 'error').length : 0 + data.error ? 1 : 0) + const count = (data.errors ? data.errors.filter(error => error.severity === 'error').length : 0) + data.error ? 1 : 0 this.emit('statusChanged', { key: count, title: `compilation failed with ${count} error${count.length > 1 ? 's' : ''}`, type: 'error' }) } // Update contract Selection diff --git a/libs/remix-solidity/src/compiler/compiler.ts b/libs/remix-solidity/src/compiler/compiler.ts index 8c0d546ca0..8f1a08b4e9 100644 --- a/libs/remix-solidity/src/compiler/compiler.ts +++ b/libs/remix-solidity/src/compiler/compiler.ts @@ -281,7 +281,8 @@ export class Compiler { }) this.state.worker.addEventListener('error', (msg: Record <'data', MessageFromWorker>) => { - this.onCompilationFinished({ error: { formattedMessage: 'Worker error: ' + msg.data } }) + const formattedMessage = `Worker error: ${msg.data && msg.data !== undefined ? msg.data : msg['message']}` + this.onCompilationFinished({ error: { formattedMessage } }) }) this.state.compileJSON = (source: SourceWithTarget) => {