Skip to Content
Nov 19, 2020 at 03:05 PM

CAP - Custom Error Handling

553 Views Last edit Nov 24, 2020 at 09:44 PM 4 rev

For some reason, my code was not able to map custom error msg ORDER_EXCEEDS_STOCK and its corresponding placeholders (see below)

<code>// i18n/
<code>ORDER_EXCEEDS_STOCK=The order of {0} books exceeds the stock by {1}

to rejection handler below

<code>// srv/catalog-service.js


req.reject(400, 'ORDER_EXCEEDS_STOCK', [val1, val2])

Below is the output that I am getting; as you can see I'm only getting back the name of my custom error msg instead of its value.

// Error msg">


Thanks in advance!