Permalink
Browse files

better error handling example spec

  • Loading branch information...
Christopher Burnett
Christopher Burnett committed Nov 20, 2012
1 parent e51dce9 commit 6eab2b18992f2cee96a86255ebf2e29a7022ac5c
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/test/scala/com/twitter/finatra/ExampleSpec.scala
@@ -116,7 +116,13 @@ class ExampleSpec extends SpecHelper {
}
error { request =>
- render.status(500).plain("whoops!").toFuture
+ request.error match {
+ case Some(e:ArithmeticException) =>
+ render.status(500).plain("whoops, divide by zero!").toFuture
+ case _ =>
+ println(request.error)
+ render.status(500).plain("Something went wrong!").toFuture
+ }
}
@@ -145,7 +151,7 @@ class ExampleSpec extends SpecHelper {
"GET /error" should "respond 500" in {
get("/error")
- response.body should equal ("whoops!")
+ response.body should equal ("whoops, divide by zero!")
response.code should equal (500)
}

0 comments on commit 6eab2b1

Please sign in to comment.