mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-07 11:22:35 +01:00
📝 improve error message
This commit is contained in:
parent
11450b6d39
commit
0c59ad5cfc
@ -56,7 +56,10 @@ mongoose.plugin((schema: Schema, opts: any) => {
|
||||
try {
|
||||
// @ts-ignore
|
||||
const isExistsQuery = JSON.stringify(this._userProvidedFields) === JSON.stringify({ _id: 1 });
|
||||
if (!doc && !isExistsQuery) return next(new HTTPError("Not found", 404));
|
||||
if (!doc && !isExistsQuery) {
|
||||
// @ts-ignore
|
||||
return next(new HTTPError(`${this?.mongooseCollection?.name}.${this?._conditions?.id} not found`, 400));
|
||||
}
|
||||
// @ts-ignore
|
||||
return next();
|
||||
} catch (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user