fix weird photo test

This commit is contained in:
2020-10-19 22:43:11 +03:00
committed by Stepan Usatiuk
parent 075f24fc43
commit a25667c969

View File

@@ -7,6 +7,7 @@ import send = require("koa-send");
import { getHash, getSize } from "~util";
import * as jwt from "jsonwebtoken";
import { config } from "~config";
import { ValidationError } from "class-validator";
export const photosRouter = new Router();
@@ -48,6 +49,13 @@ photosRouter.post("/photos/new", async (ctx) => {
} as IPhotosNewRespBody;
return;
}
if (
e.name === "ValidationError" ||
(Array.isArray(e) && e.some((e) => e instanceof ValidationError))
) {
ctx.throw(400);
return;
}
console.log(e);
ctx.throw(500);
}