1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-09-22 02:31:36 +02:00

🎨 proper error message body parser

This commit is contained in:
Flam3rboy 2021-04-06 04:05:46 +02:00
parent d700e4c8fa
commit 4f67c2c86e

View File

@ -148,9 +148,12 @@ export function instanceOf(
})
);
}
try {
if (value instanceof type) return true;
} catch (error) {
throw new FieldError("BASE_TYPE_CLASS", req.t("common:field.BASE_TYPE_CLASS", { type }));
}
}
if (typeof value !== "object") throw new FieldError("BASE_TYPE_OBJECT", req.t("common:field.BASE_TYPE_OBJECT"));