@codacy/api-typescript
Advanced tools
Comparing version 0.7.2 to 0.8.0
@@ -24,2 +24,5 @@ import * as Models from './models'; | ||
} | ||
export declare class AbortedRequest extends BaseApiError { | ||
constructor(error: ApiErrorUnion, response?: HttpOperationResponse, exception?: Error); | ||
} | ||
export declare class BadRequestApiError extends BaseApiError { | ||
@@ -26,0 +29,0 @@ constructor(error: ApiErrorUnion, response?: HttpOperationResponse, exception?: Error); |
@@ -54,2 +54,13 @@ import { __assign, __awaiter, __extends, __generator, __spreadArrays } from "tslib"; | ||
export { ApiRequestFailed }; | ||
var AbortedRequest = /** @class */ (function (_super) { | ||
__extends(AbortedRequest, _super); | ||
function AbortedRequest(error, response, exception) { | ||
var _this = _super.call(this, error, response, exception) || this; | ||
_this.name = 'AbortedRequest'; | ||
Object.setPrototypeOf(_this, AbortedRequest.prototype); | ||
return _this; | ||
} | ||
return AbortedRequest; | ||
}(BaseApiError)); | ||
export { AbortedRequest }; | ||
var BadRequestApiError = /** @class */ (function (_super) { | ||
@@ -154,8 +165,19 @@ __extends(BadRequestApiError, _super); | ||
err_1 = _a.sent(); | ||
// totally unexpected error, assume the API is not configured or broken | ||
throw new ApiRequestFailed({ | ||
message: 'Codacy API was not found, is not available, or responded with an unexpected behaviour.', | ||
error: 'ApiError', | ||
actions: [], | ||
}, undefined, err_1); | ||
if (err_1.code === 'REQUEST_ABORTED_ERROR') { | ||
// request was aborted | ||
throw new AbortedRequest({ | ||
message: 'Request was aborted.', | ||
error: 'AbortedRequest', | ||
actions: [], | ||
}, undefined, err_1); | ||
} | ||
else { | ||
// totally unexpected error, assume the API is not configured or broken | ||
throw new ApiRequestFailed({ | ||
message: 'Codacy API was not found, is not available, or responded with an unexpected behaviour.', | ||
error: 'ApiError', | ||
actions: [], | ||
}, undefined, err_1); | ||
} | ||
return [3 /*break*/, 3]; | ||
case 3: | ||
@@ -162,0 +184,0 @@ if (body !== undefined && 'error' in body && 'message' in body) { |
{ | ||
"name": "@codacy/api-typescript", | ||
"version": "0.7.2", | ||
"version": "0.8.0", | ||
"description": "Codacy API client for Typescript", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/codacy/codacy-api-typescript#readme", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
303729
6167