Use isHttpError utility provided by http-errors

This new utility method was introduced in http-errors v1.8.0. Let's use
that instead of instanceof. This also upgrades the http-errors dependency
This commit is contained in:
Viljami Kuosmanen 2020-10-25 11:38:54 +01:00 committed by John McLear
parent aef4cce0c9
commit c502ca3259
3 changed files with 25 additions and 6 deletions

View file

@ -604,7 +604,7 @@ exports.expressCreateServer = (hookName, args, cb) => {
// pass to api handler
let data = await apiHandler.handle(version, funcName, fields, req, res).catch((err) => {
// convert all errors to http errors
if (err instanceof createHTTPError.HttpError) {
if (createHTTPError.isHttpError(err)) {
// pass http errors thrown by handler forward
throw err;
} else if (err.name == 'apierror') {