
* feat: add translations for forgot password email and misc * fix: type fixes * feat: translate invitation email * fix: e2e tests * fix: lint * feat: type fixes and i18n for emails * Merge main * fix: jest import on server path * Merge * fix: playwright tests * fix: lint Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
11 lines
374 B
TypeScript
11 lines
374 B
TypeScript
export function getErrorFromUnknown(cause: unknown): Error & { statusCode?: number; code?: unknown } {
|
|
if (cause instanceof Error) {
|
|
return cause;
|
|
}
|
|
if (typeof cause === "string") {
|
|
// @ts-expect-error https://github.com/tc39/proposal-error-cause
|
|
return new Error(cause, { cause });
|
|
}
|
|
|
|
return new Error(`Unhandled error of type '${typeof cause}''`);
|
|
}
|