Skip to content

Commit

Permalink
Merge pull request #173 from Dicebot/propagate_http
Browse files Browse the repository at this point in the history
Propagate HttpStatusException from REST
  • Loading branch information
s-ludwig committed Jan 31, 2013
2 parents 78efb32 + a8f311c commit 4d48af5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source/vibe/http/rest.d
Expand Up @@ -402,6 +402,8 @@ private HttpServerRequestDelegate jsonMethodHandler(T, string method, alias FUNC
auto ret = __traits(getMember, inst, method)(params);
res.writeJsonBody(serializeToJson(ret));
}
} catch( HttpStatusException e) {
res.writeJsonBody(["statusMessage": e.msg], e.status);
} catch( Exception e ){
// TODO: better error description!
res.writeJsonBody(["statusMessage": e.msg, "statusDebugMessage": sanitizeUTF8(cast(ubyte[])e.toString())], HttpStatus.InternalServerError);
Expand Down

0 comments on commit 4d48af5

Please sign in to comment.