Fixed displaying file location when error thrown

pull/5370/head
ioedeveloper 1 year ago committed by Aniket
parent ae1c2a3f4e
commit 81ef329d3a
  1. 6
      apps/circuit-compiler/src/app/app.tsx
  2. 4
      apps/circuit-compiler/src/app/services/circomPluginClient.ts

@ -70,11 +70,13 @@ function App() {
dispatch({ type: 'SET_FILE_PATH_TO_ID', payload: filePathToId })
dispatch({ type: 'SET_COMPILER_FEEDBACK', payload: null })
})
plugin.internalEvents.on('circuit_parsing_errored', (report) => {
plugin.internalEvents.on('circuit_parsing_errored', (report, filePathToId) => {
dispatch({ type: 'SET_FILE_PATH_TO_ID', payload: filePathToId })
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'errored' })
dispatch({ type: 'SET_COMPILER_FEEDBACK', payload: report })
})
plugin.internalEvents.on('circuit_parsing_warning', (report) => {
plugin.internalEvents.on('circuit_parsing_warning', (report, filePathToId) => {
dispatch({ type: 'SET_FILE_PATH_TO_ID', payload: filePathToId })
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'warning' })
dispatch({ type: 'SET_COMPILER_FEEDBACK', payload: report })
})

@ -127,10 +127,10 @@ export class CircomPluginClient extends PluginClient {
if (parseErrors && (parseErrors.length > 0)) {
if (parseErrors[0].type === 'Error') {
this.internalEvents.emit('circuit_parsing_errored', parseErrors)
this.internalEvents.emit('circuit_parsing_errored', parseErrors, filePathToId)
return
} else if (parseErrors[0].type === 'Warning') {
this.internalEvents.emit('circuit_parsing_warning', parseErrors)
this.internalEvents.emit('circuit_parsing_warning', parseErrors, filePathToId)
}
} else {
this.internalEvents.emit('circuit_parsing_done', parseErrors, filePathToId)

Loading…
Cancel
Save