Add error code to message thrown.

circom-desktop
ioedeveloper 1 month ago
parent f20c2dfebe
commit cff213fb8f
  1. 4
      apps/circuit-compiler/src/app/app.tsx
  2. 2
      apps/circuit-compiler/src/app/services/circomPluginClient.ts
  3. 8
      apps/remixdesktop/src/plugins/circomElectronBasePlugin.ts
  4. 2
      apps/remixdesktop/src/tools/circom.ts

@ -132,9 +132,9 @@ function App() {
try {
const report = JSON.parse(err.message)
dispatch({ type: 'SET_COMPUTE_FEEDBACK', payload: report })
dispatch({ type: 'SET_COMPILER_FEEDBACK', payload: report })
} catch (e) {
dispatch({ type: 'SET_COMPUTE_FEEDBACK', payload: err.message })
dispatch({ type: 'SET_COMPILER_FEEDBACK', payload: err.message })
}
}

@ -158,7 +158,7 @@ export class CircomPluginClient extends PluginClient {
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')
this.lastCompiledCircuitPath = pathModule.normalize(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) {

@ -49,12 +49,12 @@ class CircomElectronPluginClient extends ElectronBasePluginClient {
// @ts-ignore
const wd = await this.call('fs', 'getWorkingDir')
// @ts-ignore
const outputDirExists = await this.call('fs', 'exists', extractParentFromKey(filePath) + '/.bin')
const outputDirExists = await this.call('fs', 'exists', path.normalize(extractParentFromKey(filePath) + '/.bin'))
// @ts-ignore
if (!outputDirExists) await this.call('fs', 'mkdir', extractParentFromKey(filePath) + '/.bin')
if (!outputDirExists) await this.call('fs', 'mkdir', path.normalize(extractParentFromKey(filePath) + '/.bin'))
filePath = path.join(wd, filePath)
const depPath = path.join(wd, '.deps/https/raw.githubusercontent.com/iden3/')
const outputDir = extractParentFromKey(filePath) + '/.bin'
const depPath = path.normalize(path.join(wd, '.deps/https/raw.githubusercontent.com/iden3/'))
const outputDir = path.normalize(extractParentFromKey(filePath) + '/.bin')
this.call('terminal' as any, 'logHtml', `Compiling ${filePath} with circom compiler (${version})`)
return await circomCli.run(`${filePath} -l ${depPath} -o ${outputDir}`, version, options)

@ -104,7 +104,7 @@ export const circomCli = {
return new Promise((resolve, reject) => {
exec(cmd, (error, stdout, stderr) => {
if (error) {
reject(error)
reject(`${error.message} with error code ${error.code}`)
} else {
resolve({ stdout, stderr })
}

Loading…
Cancel
Save