graphql
Version:
A Query Language and Runtime which can target any service.
14 lines • 442 B
JavaScript
import { inspect } from "./inspect.mjs";
export function toError(thrownValue) {
return thrownValue instanceof Error
? thrownValue
: new NonErrorThrown(thrownValue);
}
class NonErrorThrown extends Error {
constructor(thrownValue) {
super('Unexpected error value: ' + inspect(thrownValue));
this.name = 'NonErrorThrown';
this.thrownValue = thrownValue;
}
}
//# sourceMappingURL=toError.js.map