Related Github Documents
Document Properties
Kbid2958A4
Last Modified05-Aug-2020
Added to KB05-Aug-2020
Public AccessEveryone
StatusOnline
Doc TypeGuidelines, Concepts & Cookbooks
ProductIntershop Progressive Web App

Guide - Intershop Progressive Web App - ICM HTTP Error Mapping

ICM HTTP Error Mapping

The ICM provides a big variety of different REST resources managed by various teams and services.
As the maturity of resources varies, so does the format of HTTP errors provided by those endpoints.
The classic error response was submitted via HTTP headers and slowly the new format of providing even localized messages in the body of an error is being implemented.
For the PWA this means that potentially every service and component managing a different resource has to handle different formats.
In version 0.23 of the PWA we refactored the error handling to provide a consistent simplified format for all HTTP errors throughout the application.

Implementation

Most of the work is done by the HttpInterceptor ICMErrorMapperInterceptor.
It converts responses with error-key headers, responses with errors body and also provides a fallback mapping for errors not matching this format.

💡 Mapping the HttpErrorResponse is mandatory as the object itself is not serializable and should therefor not be pushed into the State Management!

If necessary, you can provide a custom SPECIAL_HTTP_ERROR_HANDLER for a specific use case.
All custom mappers should be provided in the ConfigurationModule.

Disclaimer

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources
Tickets