Class: ClientError

classeur-api-client. ClientError

Object representation of an error that occurred on the client during or after the processing REST API operation. Example causes if a client error (and valid values for the message property) inclide:

  • Request aborted
  • Request timed out
  • Corrupt/non-JSON-decodable content received

ClientError instances sometimes wrap Restler errors. That means that, in addition to the properties listed below, ClientError instances can contain any properties that Restler attaches to its Error objects for error, abort, and timeout events.


new ClientError()

Deprecated:
  • You should never need to construct one of these directly; they will be provided to callbacks for REST API operations as the first argument if they occur.
Source:
See:
Example
const ClientError = require('classeur-api-client').ClientError;
myClient.getFile('nonexistent', (error) => {
    if ( error instanceof ClientError ) {
        console.log(error.message); // e.g. 'JSON decoding failed!'
        throw error;
    }
});

Extends

Members


<readonly> request :Request

The HTTP request object that caused the error.

A request object as returned by the get method of restler.

Type:
  • Request
Deprecated:
  • This is usually not useful.
Source:
See:

<readonly, nullable> timeout :Number

If a timeout occurred, this property will be set to the timeout threshold that was exceeded (in milliseconds). This property will only be set if a ClientError occurred due to a timeout.

Type:
  • Number
Source:
See: