            (selector-has-content [:body] "You are signed in as email@server.com")))
 
 (facts "Not found page is shown for unknown url"
-       (-> (k/session app)
+       (-> (k/session h/app)
            (k/visit "/wrong-url")
            (page-title-is "Error-404")))
+
+(fact "Error page is shown if an exception is thrown"
+      (against-background
+         (registration-form anything) =throws=> (Exception.))
+       (-> (k/session (h/wrap-error-handling h/app))
+           (k/visit "/register")
+           (page-title-is "Error-500")))

           (selector-has-content [:.clj--registration-email__validation] "Enter a valid email address")))

(facts "User is taken to success page when user is successfully created"
       (-> (k/session app)
           (k/visit "/register")
           (k/fill-in :.func--email__input "email@server.com")
           (k/fill-in :.func--password__input "valid-password")

           (selector-has-content [:body] "You saved the user")))

(future-facts "User can sign in"
       (-> (k/session h/app)
           (k/visit "/sign-in")
           (k/fill-in :.func--email__input "email@server.com")
           (k/fill-in :.func--password__input "valid-password")
