14 lines
445 B
TypeScript
14 lines
445 B
TypeScript
import { logger } from "@/lib/logger";
|
|
|
|
/**
|
|
* Log unexpected errors through the structured application logger.
|
|
* Domain errors (validation, auth, etc.) should NOT go through here.
|
|
*/
|
|
export function reportError(error: unknown, context = "Unhandled error"): void {
|
|
const message = error instanceof Error ? error.message : String(error);
|
|
logger.error(context, {
|
|
err: message,
|
|
name: error instanceof Error ? error.name : undefined,
|
|
});
|
|
}
|