From 7db07e0b33e0a0a92729091af093a9430808fdf2 Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Mon, 28 Jun 2021 18:18:37 +0530 Subject: [PATCH] handle solc error --- .../static-analyser/src/lib/remix-ui-static-analyser.tsx | 2 ++ libs/remixd/src/services/slitherClient.ts | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx index 91b276263c..d0e654c007 100644 --- a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx +++ b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx @@ -263,6 +263,8 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { showWarningsByModule('Slither Analysis') } } + }).catch((error) => { + props.analysisModule.call('terminal', 'log', { type: 'error', value: `[Slither Analysis]: Error occured! See remixd console for details.` }) }) }) } else { diff --git a/libs/remixd/src/services/slitherClient.ts b/libs/remixd/src/services/slitherClient.ts index 903de2e0ab..54663b3d81 100644 --- a/libs/remixd/src/services/slitherClient.ts +++ b/libs/remixd/src/services/slitherClient.ts @@ -54,8 +54,14 @@ export class SlitherClient extends PluginClient { // Get compiler version with commit id e.g: 0.8.2+commit.661d110 const versionString: string = currentVersion.substring(0, currentVersion.indexOf('+commit') + 16) console.log('\x1b[32m%s\x1b[0m', `[Slither Analysis]: Compiler version is ${versionString}`) + let solcOutput: Buffer // Check solc current installed version - const solcOutput: Buffer = execSync('solc --version', options) + try{ + solcOutput = execSync('solc --version', options) + } catch(err) { + console.log(err) + reject(new Error('Error in checking solc version')) + } if (!solcOutput.toString().includes(versionString)) { console.log('\x1b[32m%s\x1b[0m', '[Slither Analysis]: Compiler version is different from installed solc version') // Get compiler version without commit id e.g: 0.8.2