express-api-problem
Version:
A minimal package to assist in returning RESTful exceptions in your APIs
13 lines (12 loc) • 589 B
TypeScript
import { MongoError } from 'mongodb';
import { NextFunction } from 'express';
import { MongooseDocument, Schema } from 'mongoose';
import { ApiProblemOptionsType } from './api-problem';
export declare type FormattedErrorType = {
field: string;
message: string;
};
declare type MongoErrorHandler = (err: MongoError, doc: MongooseDocument, next: NextFunction) => void;
export declare function getMongooseErrorHandler(options?: ApiProblemOptionsType): MongoErrorHandler;
export declare function MongooseProblemPlugin(schema: Schema, options?: ApiProblemOptionsType): void;
export {};