diff --git a/quint/src/quintVerifier.ts b/quint/src/quintVerifier.ts index 2d13f82e0..ac385438b 100644 --- a/quint/src/quintVerifier.ts +++ b/quint/src/quintVerifier.ts @@ -220,20 +220,26 @@ async function loadProtoDefViaReflection(): Promise = await new Promise((resolve, reject) => { - let responses: ServerReflectionResponse[] = [] + const response: VerifyResult = await new Promise( + (resolve, reject) => { + let responses: ServerReflectionResponse[] = [] - const call = reflectionClient.ServerReflectionInfo() - call.on('data', (r: ServerReflectionResponse) => responses.push(r)) - call.on('end', () => resolve(responses)) - call.on('error', (e: grpc.StatusObject) => reject(e)) + const call = reflectionClient.ServerReflectionInfo() + call.on('data', (r: ServerReflectionResponse) => responses.push(r)) + call.on('end', () => resolve(responses)) + call.on('error', (e: grpc.StatusObject) => reject(e)) - call.write({ file_containing_symbol: 'shai.cmdExecutor.CmdExecutor' }) - }).then(right).catch(e => err(`Apalache gRPC endpoint is corrupted. Error reading from streaming API: ${e.details}`)) + call.write({ file_containing_symbol: 'shai.cmdExecutor.CmdExecutor' }) + } + ) + .then(right) + .catch(e => err(`Apalache gRPC endpoint is corrupted. Error reading from streaming API: ${e.details}`)) return response.chain((protoDefResponses: ServerReflectionResponse[]) => { if (protoDefResponses.length === 0) { - return err(`Apalache gRPC endpoint is corrupted. Could not extract proto file: no response from reflection service`) + return err( + `Apalache gRPC endpoint is corrupted. Could not extract proto file: no response from reflection service` + ) } else if (protoDefResponses.length > 1) { return err( `Apalache gRPC endpoint is corrupted. Could not extract proto file: multiple responses from reflection service` @@ -334,7 +340,9 @@ async function connect(cmdExecutor: AsyncCmdExecutor): Promise> { // Attempt to load proto definition from Apalache distribution, else via reflection - const protoDefResult = process.env.APALACHE_DIST ? findApalacheDistribution().chain(dist => loadProtoDefViaDistribution(dist)) : await loadProtoDefViaReflection() + const protoDefResult = process.env.APALACHE_DIST + ? findApalacheDistribution().chain(dist => loadProtoDefViaDistribution(dist)) + : await loadProtoDefViaReflection() const connectionResult = await protoDefResult.chain(loadGrpcClient).asyncChain(connect) return connectionResult.asyncChain(conn => conn.check(config)) }