"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServiceError = void 0;
const SERVICE_NAME = process.env.SERVICE_NAME || 'SERVICE_NAME_NOT_DEFINED';
class ServiceError extends Error {
    constructor(httpStatus, shouldTriggerInvestigation, message) {
        super(message);
        this.shouldTriggerInvestigation = false;
        this.httpStatus = httpStatus;
        this.shouldTriggerInvestigation = shouldTriggerInvestigation;
    }
    static notImplemented() {
        return new ServiceError(501, false, `Not implemented`);
    }
    static serviceUnavailable() {
        return new ServiceError(503, false, `Service not available`);
    }
    static httpOperationNotFound(httpMethod, httpPath) {
        return new ServiceError(404, false, `Unable to find HTTP operation mapping for lambda for "${httpMethod} ${httpPath}".`);
    }
    static sqsHandlerNotFound(recordSourceArn) {
        return new ServiceError(404, false, `Unable to find mapping for SQS event from "${recordSourceArn}".`);
    }
    toString() {
        return `ServiceError in ${SERVICE_NAME}: ${this.message}`;
    }
    toErrorObject() {
        return {
            message: this.message,
            shouldTriggerInvestigation: this.shouldTriggerInvestigation,
            httpStatus: this.httpStatus,
        };
    }
}
exports.ServiceError = ServiceError;
//# sourceMappingURL=ServiceError.js.map