From e9ed7cb9fb6e53921aad7eb3279093b865292366 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 11 Aug 2022 12:12:23 +0200 Subject: [PATCH] better error messaging --- .../vyper/src/app/components/CompilerButton.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/vyper/src/app/components/CompilerButton.tsx b/apps/vyper/src/app/components/CompilerButton.tsx index fb0fb6ff05..5d32445f5a 100644 --- a/apps/vyper/src/app/components/CompilerButton.tsx +++ b/apps/vyper/src/app/components/CompilerButton.tsx @@ -28,13 +28,25 @@ function CompilerButton({ contract, setOutput, compilerUrl }: Props) { /** Compile a Contract */ async function compileContract() { try { - const _contract = await remixClient.getContract() + let _contract + try { + _contract = await remixClient.getContract() + } catch (e) { + setOutput('', { status: 'failed', message: err.message}) + return + } remixClient.changeStatus({ key: 'loading', type: 'info', title: 'Compiling' }) - const output = await compile(compilerUrl, _contract) + let output + try { + output = await compile(compilerUrl, _contract) + } catch (e) { + setOutput(_contract.name, { status: 'failed', message: err.message}) + return + } setOutput(_contract.name, output) // ERROR if (isCompilationError(output)) { @@ -61,7 +73,6 @@ function CompilerButton({ contract, setOutput, compilerUrl }: Props) { type: 'error', title: err.message }) - console.error(err) } }