Skip to content

Commit

Permalink
Kitura/Kitura#15 Refined sample
Browse files Browse the repository at this point in the history
  • Loading branch information
dfirsht committed Mar 2, 2016
1 parent 39c4006 commit 130c07c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/KituraSample/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ router.delete("/hello") {request, response, next in
// Error handling example
router.get("/error") { _, response, next in
Log.error("Example of error being set")
response.status(HttpStatusCode.INTERNAL_SERVER_ERROR)
response.error = NSError(domain: "RouterTestDomain", code: 1, userInfo: [:])
next()
}
Expand Down Expand Up @@ -194,7 +195,7 @@ router.get("/") { _, response, next in
router.error { request, response, next in
response.setHeader("Content-Type", value: "text/plain; charset=utf-8")
do {
try response.status(HttpStatusCode.OK).send("Caught the error: \(response.error!.localizedDescription)").end()
try response.send("Caught the error: \(response.error!.localizedDescription)").end()
}
catch {}
next()
Expand Down

0 comments on commit 130c07c

Please sign in to comment.