mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
10 lines
306 B
TypeScript
10 lines
306 B
TypeScript
/** Ensures `error` is an `Error */
|
|
export function ensureError(error: unknown): Error {
|
|
return error instanceof Error
|
|
? error
|
|
: new Error('Error that was not an instance of Error was thrown', {
|
|
// We should never throw anything except something that derives from Error
|
|
cause: error,
|
|
});
|
|
}
|