/map now returns the correct error status code
This commit is contained in:
parent
adca51f6de
commit
a5aa9b6cf9
1 changed files with 9 additions and 4 deletions
|
@ -59,11 +59,16 @@ export class MapController extends BaseController{
|
||||||
this.addCorsHeaders(res);
|
this.addCorsHeaders(res);
|
||||||
res.end(JSON.stringify(mapDetails));
|
res.end(JSON.stringify(mapDetails));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e.message || e);
|
if (e.response) {
|
||||||
|
res.writeStatus(e.response.status+" "+e.response.statusText);
|
||||||
|
this.addCorsHeaders(res);
|
||||||
|
res.end("An error occurred: "+e.response.status+" "+e.response.statusText);
|
||||||
|
} else {
|
||||||
res.writeStatus("500 Internal Server Error")
|
res.writeStatus("500 Internal Server Error")
|
||||||
this.addCorsHeaders(res);
|
this.addCorsHeaders(res);
|
||||||
res.end("An error occurred");
|
res.end("An error occurred");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue