Skip to content

Commit ea16dfe

Browse files
author
Andrei Bratu
committed
api errors are easier to parse
1 parent dfe5cc9 commit ea16dfe

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/evals/run.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export async function runEval<I, O>(
236236
// @ts-ignore
237237
const decoratorType = (function_.file as File).type;
238238
if (decoratorType !== type_) {
239-
throw new Error(
239+
throw new HumanloopRuntimeError(
240240
`The type of the decorated function does not match the type of the file. Expected \`${capitalize(type_)}\`, got \`${capitalize(decoratorType)}\`.`,
241241
);
242242
}
@@ -246,7 +246,9 @@ export async function runEval<I, O>(
246246
try {
247247
hlFile = await upsertFile({ file: file_, type: type_, client: client });
248248
} catch (e: any) {
249-
console.error(`${RED}Error in your \`file\` argument:\n\n${e.message}${RESET}`);
249+
console.error(
250+
`${RED}Error in your \`file\` argument:\n\n${e.constructor.name}: ${e.message}${RESET}`,
251+
);
250252
return [];
251253
}
252254

@@ -255,7 +257,7 @@ export async function runEval<I, O>(
255257
hlDataset = await upsertDataset({ dataset: dataset, client: client });
256258
} catch (e: any) {
257259
console.error(
258-
`${RED}Error in your \`dataset\` argument:\n\n${e.message}${RESET}`,
260+
`${RED}Error in your \`file\` argument:\n\n${e.constructor.name}: ${e.message}${RESET}`,
259261
);
260262
return [];
261263
}
@@ -273,7 +275,7 @@ export async function runEval<I, O>(
273275
});
274276
} catch (e: any) {
275277
console.error(
276-
`${RED}Error in your \`evaluators\` argument:\n\n${e.message}${RESET}`,
278+
`${RED}Error in your \`file\` argument:\n\n${e.constructor.name} ${e.message}${RESET}`,
277279
);
278280
return [];
279281
}

0 commit comments

Comments
 (0)