Add better error handling for when `circuitPath` is set wrong.

pull/4512/head
Evan Sangaline 9 months ago committed by Aniket
parent fb7b26c0f3
commit b230a41b24
  1. 7
      libs/remix-ws-templates/src/script-templates/sindri/utils.ts

@ -73,7 +73,12 @@ export const compile = async (tags: string | string[] | null = ['latest']): Circ
// Merge any of the circuit's resolved dependencies into the files at their expected import paths.
if (sindriManifest.circuitType === 'circom') {
const circuitPath = normalizePath(sindriManifest.circuitPath || 'circuit.circom')
const circuitContent = await remix.call('fileManager', 'readFile', circuitPath)
let circuitContent: string
try {
circuitContent = await remix.call('fileManager', 'readFile', circuitPath)
} catch (error) {
console.error(`No circuit file found at "${circuitPath}", try setting "circuitPath" in "sindri.json".`)
}
const dependencies: {[path: string]: string} = await remix.call('circuit-compiler' as any, 'resolveDependencies', circuitPath, circuitContent)
Object.entries(dependencies).forEach(([rawPath, rawContent]) => {
// Convert absolute file paths to paths relative to the project root.

Loading…
Cancel
Save