cloud-report
Version:
Collects and analyzes cloud resources
24 lines (23 loc) • 824 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
class AWSErrorHandler {
static handle(error, ...params) {
const errorCode = error.code;
if (errorCode === "OptInRequired" ||
errorCode === "SubscriptionRequiredException" ||
errorCode === "InvalidClientTokenId" ||
errorCode === "AuthFailure" ||
errorCode === "UnrecognizedClientException" ||
errorCode === "NoSuchEntity") {
return;
}
throw this.makeError(error, params);
}
static makeError(error, params) {
if (params && params.length) {
return new Error(error.code + ":" + error.message + " " + params);
}
return error;
}
}
exports.AWSErrorHandler = AWSErrorHandler;