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) include:

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

ClientError instances are usually thin wrappers around flashheart error objects, and exist only to deliniate server-caused errors from client-caused errors. ClientErrors may not contain all/most error fields supplied by flashheart, though, since ClientErrors may occur before error metadata is returned from the server.


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, 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: