mirror of
https://github.com/supabase/supabase.git
synced 2026-05-08 01:40:13 -04:00
9685711519
* add retry * handle and capture errors * adds tests * improve Sentry integration * remove SQL logging from query performance error capture * fix error msg prop handling * add max and baseline to alert * undo change meant for other branch oops
13 lines
433 B
TypeScript
13 lines
433 B
TypeScript
/**
|
|
* Extracts a human-readable error message from various error types.
|
|
*/
|
|
export function getErrorMessage(error: unknown): string | null {
|
|
if (error === null || error === undefined) return null
|
|
if (typeof error === 'string') return error
|
|
if (error instanceof Error) return error.message
|
|
if (typeof error === 'object' && error !== null && 'message' in error) {
|
|
return String(error.message)
|
|
}
|
|
return String(error)
|
|
}
|