UNPKG

@rafat97/exceptionhandler

Version:

All types exception handler classes definition

30 lines 965 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DuplicateKey = void 0; const CommonMongoServerError_1 = require("./CommonMongoServerError"); class DuplicateKey extends CommonMongoServerError_1.CommonMongoServerError { constructor(message) { super(message); this.statusCode = 409; this.mongoServerErrorCode = 11000; if (message === "") { this.message = "Duplicate key found"; } Object.setPrototypeOf(this, DuplicateKey.prototype); } getStatusCode() { return this.statusCode; } getMongoDbErrorCode() { return this.mongoServerErrorCode; } serializeErrors() { return { message: this.message, details: [], mongoServerErrorCode: this.mongoServerErrorCode, }; } } exports.DuplicateKey = DuplicateKey; //# sourceMappingURL=DuplicateKeyError.js.map