Catch thrown error

circom-desktop
ioedeveloper 1 month ago
parent 72d574f30a
commit a35ac0daf0
  1. 4
      apps/circuit-compiler/src/app/app.tsx
  2. 19
      apps/circuit-compiler/src/app/services/circomPluginClient.ts
  3. 2
      apps/remixdesktop/src/tools/circom.ts

@ -82,8 +82,8 @@ function App() {
dispatch({ type: 'REMOVE_VERSION_FROM_DOWNLOAD_LIST', payload: version })
dispatch({ type: 'SET_COMPILER_FEEDBACK', payload: null })
})
plugin.internalEvents.on('download_failed', (version) => {
dispatch({ type: 'SET_COMPILER_FEEDBACK', payload: 'Download failed! Please check your internet connection and try again.' })
plugin.internalEvents.on('download_failed', (error) => {
dispatch({ type: 'SET_COMPILER_FEEDBACK', payload: 'Download failed! Please check your internet connection. ' + error.message })
})
}, [])

@ -52,7 +52,7 @@ export class CircomPluginClient extends PluginClient {
this.call('circom', 'install', versionToInstall).then(() => {
this.internalEvents.emit('download_success', version)
}).catch((e) => {
this.internalEvents.emit('download_failed')
this.internalEvents.emit('download_failed', e)
})
} else {
if (version === '2.1.5') this.compiler = compilerV215
@ -153,13 +153,18 @@ export class CircomPluginClient extends PluginClient {
this.call('terminal', 'log', { type: 'log', value: 'Compiling ' + path })
const { version, prime } = this._compilationConfig
const versionToInstall = version === 'latest' ? 'latest' : `v${version}`
// @ts-ignore
const { stdout, stderr } = await this.call('circom', 'run', path, versionToInstall, { prime: prime, wasm: "", inputs: "" })
const fileName = extractNameFromKey(path)
try {
// @ts-ignore
const { stdout, stderr } = await this.call('circom', 'run', path, versionToInstall, { prime: prime, wasm: "", inputs: "" })
const fileName = extractNameFromKey(path)
this.lastCompiledCircuitPath = extractParentFromKey(path) + "/.bin/" + fileName.replace('.circom', '_js') + "/" + fileName.replace('circom', 'wasm')
if (stderr) this.call('terminal', 'log', { type: 'error', value: stderr })
if (stdout) this.call('terminal', 'log', { type: 'log', value: stdout })
this.lastCompiledCircuitPath = extractParentFromKey(path) + "/.bin/" + fileName.replace('.circom', '_js') + "/" + fileName.replace('circom', 'wasm')
if (stderr) this.call('terminal', 'log', { type: 'error', value: stderr })
if (stdout) this.call('terminal', 'log', { type: 'log', value: stdout })
} catch (error) {
this.call('terminal', 'log', { type: 'error', value: error.message })
return
}
// @ts-ignore
const signals = await this.call('circom', 'getInputs')

@ -84,7 +84,7 @@ export const circomCli = {
await downloadFile(installationUrl, installationPath)
} catch (e) {
fs.rmSync(installationPath)
throw new Error('Download failed!')
throw new Error(e.message)
}
},

Loading…
Cancel
Save