dw.system
Class RESTErrorResponse

This class represents a REST error response that is compliant with
RFC 9457. It can only be instantiated using the
createError
methods in RESTResponseMgr.
Here is an example:
var error = RESTResponseMgr.createError(400);
error.custom.foo = "bar";
error.render();
The above script would result in an HTTP response with status code 400 and the following body:
{
"type": "https://api.commercecloud.salesforce.com/documentation/error/v1/custom-errors/bad-request",
"c_foo": "bar"
}
NOTE:
- Custom attributes are rendered with "c_" prefix as shown in the example above.
- Rendering works as described in JSON.stringify(Object).
Properties
custom
:
CustomAttributes
(Read Only)
All the custom attributes associated with the error response object. The attributes are stored for the
lifetime of the error response object.
Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
getCustom()
:
CustomAttributes
Returns all the custom attributes associated with the error response object.
render()
:
void
Sends the RESTErrorResponse object as an HTTP error response to the client, adhering to RFC 9457.
Methods inherited from class
Object
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
Salesforce Commerce Cloud Courses
Salesforce B2C Commerce Developer - Certification Tests
Why risk failing the SFCC exam? Get 180 real questions, killer content, and everything you need to crush the Salesforce B2C Commerce Developer certification.
Becoming a Salesforce B2C Commerce Developer is your ticket to higher salaries, better job opportunities, and the credibility to stand out from the competition. But let's be honestβpassing the certification exam isn't easy. That's where we come in.
Becoming a Salesforce B2C Commerce Developer is your ticket to higher salaries, better job opportunities, and the credibility to stand out from the competition. But let's be honestβpassing the certification exam isn't easy. That's where we come in.
Salesforce Javascript Developer I - Certification Tests
Not just another prep courseβthis is your shortcut to passing. Master JavaScript for Salesforce and go from 'hoping to pass' to knowing you will. Ready to start?
This isn't just another prep courseβit's your shortcut to mastering the skills and confidence you need to pass. With multiple practice tests covering every section and a final exam simulation designed to mirror the real thing, you'll feel like you've already aced it before test day.
This isn't just another prep courseβit's your shortcut to mastering the skills and confidence you need to pass. With multiple practice tests covering every section and a final exam simulation designed to mirror the real thing, you'll feel like you've already aced it before test day.
Salesforce B2C Commerce Architect - Certification Tests
Think the Developer exam was hard? Welcome to the next level.
The Salesforce B2C Commerce Architect certification is a whole different gameβcomplex solutions, elevated difficulty, and skills that set you apart in the eCommerce industry. That's why we're including 11 downloadable PDF guides, packed with best practices and strategies to help you prepare for the exam and build confidence in every topic.
The Salesforce B2C Commerce Architect certification is a whole different gameβcomplex solutions, elevated difficulty, and skills that set you apart in the eCommerce industry. That's why we're including 11 downloadable PDF guides, packed with best practices and strategies to help you prepare for the exam and build confidence in every topic.
Method Detail
getCustom
getCustom()
:
CustomAttributes
Returns all the custom attributes associated with the error response object. The attributes are stored for the
lifetime of the error response object.
Returns:
All the custom attributes associated with the error response object.
render
render()
:
void
Sends the RESTErrorResponse object as an HTTP error response to the client, adhering to
RFC 9457. This method sets the "Content-Type" header to
"application/problem+json", HTTP Status Code to statusCode attribute and constructs the body from type, title,
detail and custom attributes of the object. Custom attributes are rendered with "c_" prefix to the attribute
name.
Throws:
IllegalStateException
-
If the RESTErrorResponse object is already rendered.
Exception
-
If there is an error while serializing the RESTErrorResponse object.