INNER CODE UNIT · TypeScript
PromiseAllWithErrorsError
austin-starks/Promptimizer · src/utils/index.ts:72
export class PromiseAllWithErrorsError<T> extends Error {
successes: T[];
errors: string[];
constructor(successes: T[], errors: string[]) {
super(`Errors: ${errors.join("; ")}`);
this.name = "PromiseAllWithErrorsError";
this.successes = successes;
this.errors = errors;
}
}
export const handlePromiseAllWithErrorsError = (err: Error) => {
if (err instanceof PromiseAllWithErrorsError) {
for (const error of err.errors) {
console.error(error);
}
return err.successes;