| Current Path : /home/deltalab/PMS/sms-connector/node_modules/graphql-compose-mongoose/lib/errors/ |
| Current File : //home/deltalab/PMS/sms-connector/node_modules/graphql-compose-mongoose/lib/errors/index.js |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getErrorInterface = exports.RuntimeError = exports.ValidationError = void 0;
const MongoError_1 = require("./MongoError");
const ValidationError_1 = require("./ValidationError");
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return ValidationError_1.ValidationError; } });
const RuntimeError_1 = require("./RuntimeError");
Object.defineProperty(exports, "RuntimeError", { enumerable: true, get: function () { return RuntimeError_1.RuntimeError; } });
function getErrorInterface(schemaComposer) {
const ErrorInterface = schemaComposer.getOrCreateIFTC('ErrorInterface', (iftc) => {
iftc.addFields({
message: {
description: 'Generic error message',
type: 'String',
},
});
const ValidationErrorOTC = ValidationError_1.getValidationErrorOTC(schemaComposer);
const MongoErrorOTC = MongoError_1.getMongoErrorOTC(schemaComposer);
const RuntimeErrorOTC = RuntimeError_1.getRuntimeErrorOTC(schemaComposer);
ValidationErrorOTC.addInterface(iftc);
MongoErrorOTC.addInterface(iftc);
RuntimeErrorOTC.addInterface(iftc);
schemaComposer.addSchemaMustHaveType(ValidationErrorOTC);
schemaComposer.addSchemaMustHaveType(MongoErrorOTC);
schemaComposer.addSchemaMustHaveType(RuntimeErrorOTC);
const ValidationErrorType = ValidationErrorOTC.getType();
const MongoErrorType = MongoErrorOTC.getType();
const RuntimeErrorType = RuntimeErrorOTC.getType();
iftc.setResolveType((value) => {
switch (value === null || value === void 0 ? void 0 : value.name) {
case 'ValidationError':
return ValidationErrorType;
case 'MongoError':
return MongoErrorType;
default:
return RuntimeErrorType;
}
});
});
return ErrorInterface;
}
exports.getErrorInterface = getErrorInterface;
//# sourceMappingURL=index.js.map