CarpServiceRequestException
Exception for CAWS REST/HTTP service communication.
Thrown for non-success HTTP responses with a decodable JSON body, including CAWS application exceptions. The latter typically arise from CARP Core exceptions on the server side, which are mapped to HTTP status codes and messages sent back to the client. Transport failures and undecodable response bodies can propagate as other exceptions.
- Inheritance
-
- Object
- CarpServiceException
- CarpServiceRequestException
- Implementers
Constructors
CarpServiceRequestException.fromHttpStatus
- int httpStatusCode,
- dynamic response
Creates the matching exception from an HTTP httpStatusCode and the decoded JSON response body.
Returns a CarpBadRequestException, CarpUnauthorizedException, CarpNotFoundException or CarpInternalServerException for the matching status codes, and a plain CarpServiceRequestException otherwise.
There are two types of error messages - from CAWS and from NGINX. CAWS errors contain 'path' and 'exception' fields, whereas NGINX errors contain an 'instance' field.
CarpServiceRequestException
- String message, {
- required HTTPStatus httpStatus,
- String? exception,
- String? path,
Properties
exception
The Java exception from CARP Core.
httpStatus
The HTTP status from CAWS associated with this exception.
path
The URL path that caused the exception.
Methods
toString
A string representation of this object.
Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.
Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.