Home > widget-integration > CartDrawerRecommendationController > getErrorMessage
CartDrawerRecommendationController.getErrorMessage() method
Extract a user-friendly error message from an error. Override to customize error messages for shop-specific error patterns or to add localization support.
Signature:
protected getErrorMessage(error: unknown): string;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
error |
unknown |
The error object (may be an Error instance or unknown type) |
Returns:
string
User-friendly error message string
Example
Override to add localized or shop-specific error messages:
protected getErrorMessage(error: unknown) {
if (error instanceof Error && error.message.includes('limit')) {
return 'Maximum cart limit reached for this item';
}
return super.getErrorMessage(error);
}