Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ts): Export MongooseError class #13403

Merged
merged 1 commit into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ module.exports.Mixed = mongoose.Mixed;
module.exports.Date = mongoose.Date;
module.exports.Number = mongoose.Number;
module.exports.Error = mongoose.Error;
module.exports.MongooseError = mongoose.MongooseError;
module.exports.now = mongoose.now;
module.exports.CastError = mongoose.CastError;
module.exports.SchemaTypeOptions = mongoose.SchemaTypeOptions;
Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,7 @@ Mongoose.prototype.Number = SchemaTypes.Number;
*/

Mongoose.prototype.Error = require('./error/index');
Mongoose.prototype.MongooseError = require('./error/mongooseError');

/**
* Mongoose uses this function to get the current time when setting
Expand Down
2 changes: 1 addition & 1 deletion types/error.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ declare module 'mongoose' {
type CastError = Error.CastError;
type SyncIndexesError = Error.SyncIndexesError;

class MongooseError extends global.Error {
export class MongooseError extends global.Error {
constructor(msg: string);

/** The type of error. "MongooseError" for generic errors. */
Expand Down