Implement error handling and adjust import paths
This commit introduces error handling in the 'database-webhook-handler.service.ts' to log and rethrow errors when processing webhooks. It also adjusts the import paths for ContentlayerClient and WordpressClient in 'create-cms-client.ts'. Method names in 'database-webhook-router.service.ts' have been updated for clarity.
This commit is contained in:
@@ -36,16 +36,30 @@ export class DatabaseWebhookHandlerService {
|
||||
// handle the webhook
|
||||
const service = new DatabaseWebhookRouterService(client);
|
||||
|
||||
await service.handleWebhook(json);
|
||||
try {
|
||||
await service.handleWebhook(json);
|
||||
|
||||
Logger.info(
|
||||
{
|
||||
name: this.namespace,
|
||||
table,
|
||||
type,
|
||||
},
|
||||
'Webhook processed successfully',
|
||||
);
|
||||
Logger.info(
|
||||
{
|
||||
name: this.namespace,
|
||||
table,
|
||||
type,
|
||||
},
|
||||
'Webhook processed successfully',
|
||||
);
|
||||
} catch (error) {
|
||||
Logger.error(
|
||||
{
|
||||
name: this.namespace,
|
||||
table,
|
||||
type,
|
||||
error,
|
||||
},
|
||||
'Failed to process webhook',
|
||||
);
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
private assertSignatureIsAuthentic(request: Request, webhooksSecret: string) {
|
||||
|
||||
Reference in New Issue
Block a user