-
-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
imp: Improve the experience of errors when starting the web UI
Related issue: #885
- Loading branch information
Showing
7 changed files
with
105 additions
and
45 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
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,32 @@ | ||
{-# OPTIONS_GHC -fno-warn-orphans #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE QuasiQuotes #-} | ||
{-# LANGUAGE TemplateHaskell #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
|
||
-- | Define the web application's if something went wrong, in the usual Yesod style. | ||
|
||
module Hledger.Web.Error where | ||
|
||
import Yesod | ||
|
||
import Hledger.Web.Settings (widgetFile) | ||
|
||
newtype Error = Error { problem :: String } | ||
|
||
-- This is where we define the one route of the application if | ||
-- something went wrong. For a full explanation of the syntax, | ||
-- please see: http://www.yesodweb.com/book/handler | ||
mkYesod "Error" [parseRoutes| | ||
/ ErrorR GET | ||
|] | ||
|
||
instance Yesod Error | ||
|
||
-- | The error view. | ||
getErrorR :: Handler Html | ||
getErrorR = defaultLayout $ do | ||
Error problem <- getYesod | ||
setTitle "Error - hledger-web" | ||
$(widgetFile "error") | ||
|
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
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,6 @@ | ||
<h2> | ||
Woops! | ||
|
||
<p> | ||
<pre> | ||
#{problem} |
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