ClientError

ClientError

The ClientError class represents errors whose origin lie client-side. Incorrectly formatted requests, wrong methods used for API calls and invalid tokens are some examples of a ClientError. An appropriate error information and status code is shared with the client when a ClientError is thrown.

Constructor

new ClientError(code, message, help)

Initialises a ClientError with the given HTTP status code, the error message and an optional debugging help text.

Parameters:
Name Type Description
code Code

HTTP status code for the error response

message string

The error message

help string

Optional debugging help text

Source:

Methods

Export() → {any}

Sanitises a ClientError object by getting rid of the code property. Sending the code property client-side could make the impression that client shouldn't pay attention to the HTTP response's status header and should code against the response body's code property instead. That would be a bad design choice.

Source:
Returns:

A ClientError object without the code.

Type
any