biketrack-app/node_modules/@ethersphere/bee-js/dist/mjs/utils/error.js

47 lines
1.4 KiB
JavaScript
Raw Normal View History

2022-07-11 10:27:11 +02:00
export class BeeError extends Error {
constructor(message) {
super(message);
}
}
export class BeeArgumentError extends BeeError {
constructor(message, value) {
super(message);
this.value = value;
}
}
export class BeeRequestError extends BeeError {
/**
* @param message
* @param requestOptions KyOptions that were used to assemble the request. THIS MIGHT NOT BE COMPLETE! If custom Ky instance was used that has set defaults then these defaults are not visible in this object!
*/
constructor(message, requestOptions) {
super(message);
this.requestOptions = requestOptions;
}
}
export class BeeResponseError extends BeeError {
/**
* @param status HTTP status code number
* @param response Response returned from the server
* @param responseBody Response body as string which is returned from response.text() call
* @param requestOptions KyOptions that were used to assemble the request. THIS MIGHT NOT BE COMPLETE! If custom Ky instance was used that has set defaults then these defaults are not visible in this object!
* @param message
*/
constructor(status, response, responseBody, requestOptions, message) {
super(message);
this.status = status;
this.response = response;
this.responseBody = responseBody;
this.requestOptions = requestOptions;
}
}
export class BeeNotAJsonError extends BeeError {
constructor() {
super(`Received response is not valid JSON.`);
}
}