Merge pull request #1256 from ethereum/returnCompilationResult

Return compilation result instead of a label && take in account the error prop…
pull/7/head
yann300 5 years ago committed by GitHub
commit 8ebfea6e6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      remix-tests/src/compiler.ts

@ -73,10 +73,12 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts:
compiler.compile(sources, filepath)
}
], function (err: Error | null | undefined, result: any) {
let errors = (result.errors || []).filter((e) => e.type === 'Error' || e.severity === 'error')
let error: Error[] = []
if (result.error) error.push(result.error)
let errors = (result.errors || error).filter((e) => e.type === 'Error' || e.severity === 'error')
if (errors.length > 0) {
if (!isBrowser) require('signale').fatal(errors)
return cb(new Error('errors compiling'))
return cb(errors)
}
cb(err, result.contracts)
})
@ -121,7 +123,7 @@ export function compileContractSources(sources: SrcIfc, importFileCb: any, opts:
let errors = (result.errors || error).filter((e) => e.type === 'Error' || e.severity === 'error')
if (errors.length > 0) {
if (!isBrowser) require('signale').fatal(errors)
return cb(new Error('errors compiling'))
return cb(errors)
}
cb(err, result.contracts)
})

Loading…
Cancel
Save