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:
giancarlo
2024-04-02 16:03:11 +08:00
parent eb43059fda
commit 2dc2c6461e
3 changed files with 37 additions and 19 deletions

View File

@@ -19,18 +19,18 @@ export async function createCmsClient(
return getWordpressClient();
default:
throw new Error(`Unknown CMS type: ${type}`);
throw new Error(`Unknown CMS type`);
}
}
async function getContentLayerClient() {
const { ContentlayerClient } = await import('../../contentlayer');
const { ContentlayerClient } = await import('../../contentlayer/src/client');
return new ContentlayerClient();
}
async function getWordpressClient() {
const { WordpressClient } = await import('../../wordpress');
const { WordpressClient } = await import('../../wordpress/src/wp-client');
return new WordpressClient();
}