]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/servers.ts
refactor API errors to standard error format
[github/Chocobozzz/PeerTube.git] / server / middlewares / servers.ts
index 5e1c165f06d0a98bb1332ae43bf4e4cfcf3b381a..9aa56bc93399478bd3894d899eea0f367af11cbb 100644 (file)
@@ -10,7 +10,10 @@ function setBodyHostsPort (req: express.Request, res: express.Response, next: ex
 
     // Problem with the url parsing?
     if (hostWithPort === null) {
-      return res.sendStatus(HttpStatusCode.INTERNAL_SERVER_ERROR_500)
+      return res.fail({
+        status: HttpStatusCode.INTERNAL_SERVER_ERROR_500,
+        message: 'Could not parse hosts'
+      })
     }
 
     req.body.hosts[i] = hostWithPort