channelape-sdk
Version:
A client for interacting with ChannelApe's API
18 lines • 719 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const ChannelApeError_1 = require("../model/ChannelApeError");
function generateApiError(url, response, body, expectedStatusCode) {
let thisBody = body;
if (thisBody === undefined) {
thisBody = {};
}
if (thisBody.errors === undefined) {
thisBody.errors = [];
}
return new ChannelApeError_1.default(getErrorMessage(response, expectedStatusCode), response, url, thisBody.errors);
}
exports.default = generateApiError;
function getErrorMessage(response, expectedStatusCode) {
return `Expected Status ${expectedStatusCode} but got ${response.statusCode}`;
}
//# sourceMappingURL=GenerateApiError.js.map