Files
supabase/apps/studio/lib/get-error-message.ts
Jordi Enric 9685711519 chore(query-perf): better error handling and sentry tracking (#41278)
* 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
2025-12-15 20:39:09 +01:00

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)
}