Skip to content

Commit 65d4d72

Browse files
committed
chore: improve error messages
1 parent 46e65f7 commit 65d4d72

File tree

1 file changed

+8
-1
lines changed
  • packages/instrument-interpreter/src

1 file changed

+8
-1
lines changed

packages/instrument-interpreter/src/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ export class InstrumentInterpreter {
2828
options?: InterpretOptions<TKind>
2929
): Promise<SomeInstrument<TKind>> {
3030
let instrument: AnyInstrument;
31+
let value: unknown;
3132
try {
32-
const value: unknown = await evaluateInstrument(bundle);
33+
value = await evaluateInstrument(bundle);
3334
if (!options?.validate) {
3435
instrument = value as SomeInstrument<TKind>;
3536
} else if (options.kind === 'FORM') {
@@ -44,6 +45,12 @@ export class InstrumentInterpreter {
4445
throw new Error(`Unexpected kind: ${options.kind}`);
4546
}
4647
} catch (error) {
48+
if (value) {
49+
console.error({
50+
message: 'Validation Error',
51+
value
52+
});
53+
}
4754
throw new Error(`Failed to evaluate instrument bundle`, { cause: error });
4855
}
4956
instrument.id = options?.id;

0 commit comments

Comments
 (0)