51 lines
1.9 KiB
JavaScript
51 lines
1.9 KiB
JavaScript
|
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
exports.BeeNotAJsonError = exports.BeeResponseError = exports.BeeRequestError = exports.BeeArgumentError = exports.BeeError = void 0;
|
||
|
class BeeError extends Error {
|
||
|
constructor(message) {
|
||
|
super(message);
|
||
|
}
|
||
|
}
|
||
|
exports.BeeError = BeeError;
|
||
|
class BeeArgumentError extends BeeError {
|
||
|
constructor(message, value) {
|
||
|
super(message);
|
||
|
this.value = value;
|
||
|
}
|
||
|
}
|
||
|
exports.BeeArgumentError = BeeArgumentError;
|
||
|
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;
|
||
|
}
|
||
|
}
|
||
|
exports.BeeRequestError = BeeRequestError;
|
||
|
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;
|
||
|
}
|
||
|
}
|
||
|
exports.BeeResponseError = BeeResponseError;
|
||
|
class BeeNotAJsonError extends BeeError {
|
||
|
constructor() {
|
||
|
super(`Received response is not valid JSON.`);
|
||
|
}
|
||
|
}
|
||
|
exports.BeeNotAJsonError = BeeNotAJsonError;
|