Home > widget-integration > FilterModule > handleBlockInitError

FilterModule.handleBlockInitError() method

Handles errors during filter block initialization.

Logs initialization errors to the console without throwing, preventing one failed widget from breaking other widgets or the application.

Signature:

protected handleBlockInitError(error: Error, block: AppBlock): void;

Parameters

Parameter

Type

Description

error

Error

The error that occurred during initialization

block

AppBlock

The AppBlock that failed to initialize

Returns:

void

Remarks

Override this method to add custom error handling, error reporting to analytics services, or shop-specific error recovery logic.

Example

Override to add error tracking:

protected handleBlockInitError(error: Error, block: AppBlock): void {
  super.handleBlockInitError(error, block);
  // Send to error tracking service
  this.errorTracker.captureException(error, {
    context: 'filter-widget-init',
    blockId: block.id,
    blockType: block.blockType
  });
}