Skip to content

Commit

Permalink
Catch errors when reading Apalache config
Browse files Browse the repository at this point in the history
  • Loading branch information
thpani committed Oct 11, 2023
1 parent 80763ed commit b00b835
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions quint/src/cliCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,14 @@ export async function runSimulator(prev: TypecheckedStage): Promise<CLIProcedure
export async function verifySpec(prev: TypecheckedStage): Promise<CLIProcedure<VerifiedStage>> {
const verifying = { ...prev, stage: 'verifying' as stage }
const args = verifying.args
// TODO error handing for file reads and deserde
const loadedConfig = args.apalacheConfig ? JSON.parse(readFileSync(args.apalacheConfig, 'utf-8')) : {}
let loadedConfig: any = {}
try {
if (args.apalacheConfig) {
loadedConfig = JSON.parse(readFileSync(args.apalacheConfig, 'utf-8'))
}
} catch (err: any) {
return cliErr(`failed to read Apalache config: ${err.message}`, { ...verifying, errors: [], sourceCode: '' })
}

const mainArg = prev.args.main
const mainName = mainArg ? mainArg : basename(prev.args.input, '.qnt')
Expand Down

0 comments on commit b00b835

Please sign in to comment.