mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
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:
parent
aef4cce0c9
commit
c502ca3259
3 changed files with 25 additions and 6 deletions
|
@ -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') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue