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:
Example
const ServerError = require('classeur-api-client').ServerError; myClient.getFile('nonexistent', (error) => { if ( error instanceof ServerError ) { console.log(error.message); // e.g. 'Server error (400): bad request' console.log(error.reason); // e.g. 'File name is too short' console.log(error.status); // e.g. 400 throw error; } });
Extends
Members
-
<readonly> data :Object
The JSON-decoded data send back from the server with the error.
-
JSON decoding failures will raise a module:classeur-api-client.ClientError instead.
Type:
- Object
- Deprecated:
-
- This is usually not useful; the properties `reason`, `status`, and `shortReason` are usually all that is contained in `data`, and they are directly readable.
- Source:
-
<readonly> reason :String
-
Information sent back by the server indicating why a request failed. This is usually the best source for detailed failure/debugging information.
Type:
- String
- Source:
-
<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:
-
The restler source for the Request constructor.
-
<readonly> shortReason :String
-
English version of ServerError#status. Usually a short word or phrase explaining what a given error code means in HTTP convention.
Type:
- String
- Source:
-
<readonly> status :Number
-
HTTP status code of the error.
Type:
- Number
- Source: