Approve database migration

This commit is contained in:
gpt-engineer-app[bot]
2025-11-03 15:18:06 +00:00
parent 5612d19d07
commit a86da6e833
17 changed files with 1189 additions and 36 deletions

View File

@@ -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 = (