mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2026-09-28 04:31:43 +02: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,
|
|
});
|
|
}
|