1
0
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:
Flam3rboy 2021-08-12 16:45:41 +02:00
parent 11450b6d39
commit 0c59ad5cfc

View File

@ -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) {