mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 11:11:12 -05:00
Approve database migration
This commit is contained in:
@@ -21,7 +21,10 @@ export class AppError extends Error {
|
||||
export const handleError = (
|
||||
error: unknown,
|
||||
context: ErrorContext
|
||||
): void => {
|
||||
): string => { // Now returns error ID
|
||||
const errorId = context.metadata?.requestId as string | undefined;
|
||||
const shortErrorId = errorId ? errorId.slice(0, 8) : undefined;
|
||||
|
||||
const errorMessage = error instanceof AppError
|
||||
? error.userMessage || error.message
|
||||
: error instanceof Error
|
||||
@@ -32,14 +35,19 @@ export const handleError = (
|
||||
logger.error('Error occurred', {
|
||||
...context,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
stack: error instanceof Error ? error.stack : undefined
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
errorId,
|
||||
});
|
||||
|
||||
// Show user-friendly toast
|
||||
// Show user-friendly toast with error ID
|
||||
toast.error(context.action, {
|
||||
description: errorMessage,
|
||||
duration: 5000
|
||||
description: shortErrorId
|
||||
? `${errorMessage}\n\nReference ID: ${shortErrorId}`
|
||||
: errorMessage,
|
||||
duration: 5000,
|
||||
});
|
||||
|
||||
return errorId || 'unknown';
|
||||
};
|
||||
|
||||
export const handleSuccess = (
|
||||
|
||||
Reference in New Issue
Block a user