Fix server hang issue
This commit is contained in:
@@ -79,7 +79,7 @@ export class AuthRoutes {
|
||||
let User = this.db.User
|
||||
|
||||
if (!email || !password) {
|
||||
createError.BadRequest("Must supply user name and password")
|
||||
throw createError.BadRequest("Must supply user name and password")
|
||||
}
|
||||
|
||||
// Lookup the user
|
||||
|
||||
@@ -7,9 +7,9 @@ export { TeamRoutes } from "./TeamRoutes"
|
||||
import createError from "http-errors"
|
||||
|
||||
export function catchAll(routeHandler) {
|
||||
return (req, res, next) => {
|
||||
return async (req, res, next) => {
|
||||
try {
|
||||
routeHandler(req, res, next)
|
||||
await routeHandler(req, res, next)
|
||||
} catch (err) {
|
||||
if (err instanceof createError.HttpError) {
|
||||
next(err)
|
||||
|
||||
Reference in New Issue
Block a user