Refactor billing code and add error monitoring
Refactored the code that retrieves the billing customer id by renaming the function getBillingCustomerId to getCustomerId. Also, bolstered error handling: implemented exception capture in particular scenarios across multiple files. If an error occurs, it's now captured and reported to the configured provider.
This commit is contained in:
@@ -12,3 +12,14 @@ export const zodParseFactory =
|
||||
throw new Error(`Invalid data: ${err as string}`);
|
||||
}
|
||||
};
|
||||
|
||||
export async function captureException(exception: unknown) {
|
||||
const { getServerMonitoringService } = await import('@kit/monitoring/server');
|
||||
|
||||
const service = await getServerMonitoringService();
|
||||
|
||||
const error =
|
||||
exception instanceof Error ? exception : new Error(exception as string);
|
||||
|
||||
return service.captureException(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user