samples icon indicating copy to clipboard operation
samples copied to clipboard

How to show custom Error message based on the `errorCode` from the API.

Open hansakaRightS opened this issue 2 years ago • 0 comments

i have a user details verification on the user register and it returns the following response. the message is showing up on the ui on the following div.

i want to show a localized custom message based on the errorCode in the UI. Can anyone please guide me on the correct path on this? im little bit new to this.

example -> 2013 - should show the message 'User already exists' 2014 - should show the message 'Email is in use`

i found this but not sure how to configure this in my custom policy - the https://stackoverflow.com/questions/59788906/localised-message-for-restapi-error-response-in-b2c-custom-policy

{
  "status":"400",
  "errorCode":"2013",
  "message":"2013."
}

<div id="claimVerificationServerError" class="error pageLevel" style="display: block;" aria-hidden="false" role="alert" aria-live="polite" tabindex="1"></div>

is there a way to edit the response before its showing up on the UI?

hansakaRightS avatar Oct 12 '23 07:10 hansakaRightS