Permalink
Browse files

autogen for 1.1.0

  • Loading branch information...
capotej committed Nov 20, 2012
1 parent 6f63a25 commit dbc82908360f3cb4cfc4388c28f593f17258fab2
View
@@ -42,7 +42,7 @@
<dependency>
<groupId>com.twitter</groupId>
<artifactId>finatra</artifactId>
- <version>1.0.3</version>
+ <version>1.1.0</version>
</dependency>
</dependencies>
@@ -83,6 +83,31 @@ object App {
val anView = new AnView
render.view(anView).toFuture
}
+
+
+ /**
+ * Custom Error Handling
+ *
+ * curl http://localhost:7070/error
+ */
+ get("/error") { request =>
+ 1234/0
+ render.plain("we never make it here").toFuture
+ }
+
+ error { request =>
+ render.status(500).plain("whoops!").toFuture
+ }
+
+
+ /**
+ * Custom 404s
+ *
+ * curl http://localhost:7070/notfound
+ */
+ notFound { request =>
+ render.status(404).plain("not found yo").toFuture
+ }
}
val app = new ExampleApp
@@ -10,6 +10,18 @@ class AppSpec extends SpecHelper {
val app = new App.ExampleApp
+ "GET /notfound" should "respond 404" in {
+ get("/notfound")
+ response.body should equal ("not found yo")
+ response.code should equal (404)
+ }
+
+ "GET /error" should "respond 500" in {
+ get("/error")
+ response.body should equal ("whoops!")
+ response.code should equal (500)
+ }
+
"GET /hello" should "respond with hello world" in {
get("/")
response.body should equal ("hello world")

0 comments on commit dbc8290

Please sign in to comment.