feat: add basic webui
This commit is contained in:
24
packages/observability/error.ts
Normal file
24
packages/observability/error.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { captureException } from '@sentry/nextjs';
|
||||
import { log } from './log';
|
||||
|
||||
export const parseError = (error: unknown): string => {
|
||||
let message = 'An error occurred';
|
||||
|
||||
if (error instanceof Error) {
|
||||
message = error.message;
|
||||
} else if (error && typeof error === 'object' && 'message' in error) {
|
||||
message = error.message as string;
|
||||
} else {
|
||||
message = String(error);
|
||||
}
|
||||
|
||||
try {
|
||||
captureException(error);
|
||||
log.error(`Parsing error: ${message}`);
|
||||
} catch (newError) {
|
||||
// biome-ignore lint/suspicious/noConsole: Need console here
|
||||
console.error('Error parsing error:', newError);
|
||||
}
|
||||
|
||||
return message;
|
||||
};
|
||||
Reference in New Issue
Block a user