forked from dom96/jester
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix dom96#211 - custom routers now get the same default error handlin…
…g as normal routers
- Loading branch information
Showing
3 changed files
with
71 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import jester | ||
|
||
router myrouter: | ||
get "/": | ||
resp "Hello world" | ||
|
||
get "/raise": | ||
raise newException(Exception, "Foobar") | ||
|
||
error Exception: | ||
resp Http500, "Something bad happened: " & exception.msg | ||
|
||
when isMainModule: | ||
let s = newSettings( | ||
Port(5454), | ||
bindAddr="127.0.0.1", | ||
) | ||
var jest = initJester(myrouter, s) | ||
# jest.register(myrouterErrorHandler) | ||
jest.serve() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters