Home > widget-integration > RecommendationModule > handleBlockInitError
RecommendationModule.handleBlockInitError() method
Handles errors during block initialization. Override this method to customize error handling, reporting, or recovery logic.
Signature:
protected handleBlockInitError(error: Error, block: AppBlock): void;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
error |
Error |
The error that occurred during initialization |
|
block |
The AppBlock that failed to initialize |
Returns:
void
Remarks
The default implementation logs errors to the console. Technical Support teams can extend this to integrate with shop-specific error tracking services (e.g., Sentry, Bugsnag) or implement custom fallback behavior.
Example
// Custom error reporting to shop's monitoring system protected handleBlockInitError(error: Error, block: AppBlock): void { this.sendToShopMonitoring({ type: 'widget_init_error', widgetId: block.id, error: error.message, }); super.handleBlockInitError(error, block); }