Class: ServerError

classeur-api-client. ServerError

Object representation of an error that occurred on the server while performing a REST API operation. This is a thin wrapper around a flashheart error object, and exists as a separate class only to deliniate server-caused errors from client-caused errors.


new ServerError()

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 ServerError = require('classeur-api-client').ServerError
myClient.getFile('nonexistent', (error) => {
    if ( error instanceof ServerError ) {
        console.log(error.message) // e.g. 'Server error: Received HTTP code 403 for GET https:// ...'
        console.log(error.reason) // e.g. 'file_is_not_readable'
        console.log(error.status) // e.g. 403
        throw error
    }
})

Extends

Members


<readonly> headers :Object

If headers were returned from the server with the error, this object will contain their contents. It is supplied directly by the flashheart REST client library.

Type:
  • Object
Source:
See:

<readonly> status :Number

HTTP status code of the error.

Type:
  • Number
Source: