on master help sign in
Prettier error messages
069651eMichael Snoyman
Network/Wai/Handler/DevelServer.hs+5−2
@@ -15,7 +15,7 @@ import Network.Wai
15import Data.Text.Lazy (pack)
15import Data.Text.Lazy (pack)
16import Data.Text.Lazy.Encoding (encodeUtf8)
16import Data.Text.Lazy.Encoding (encodeUtf8)
17import qualified Data.ByteString.Lazy.Char8 as L8
17import qualified Data.ByteString.Lazy.Char8 as L8
18−import Control.Exception (Exception, SomeException, toException)
18+import Control.Exception (Exception, SomeException, toException, fromException)
19import qualified Control.Exception as E
19import qualified Control.Exception as E
20import Control.Concurrent (forkIO, threadDelay)
20import Control.Concurrent (forkIO, threadDelay)
21
21
@@ -151,7 +151,10 @@ loadingApp err f =
151 ) $ toMessage err
151 ) $ toMessage err
152 where
152 where
153 toMessage Nothing = "Loading code changes, please wait"
153 toMessage Nothing = "Loading code changes, please wait"
154− toMessage (Just err') = charsToLBS $ "Error loading code: " ++ show err'
154+ toMessage (Just err') = charsToLBS $ "Error loading code: " ++
155+ (case fromException err' of
156+ Just e -> showInterpError e
157+ Nothing -> show err')
155
158
156charsToLBS :: String -> L8.ByteString
159charsToLBS :: String -> L8.ByteString
157charsToLBS = encodeUtf8 . pack
160charsToLBS = encodeUtf8 . pack
wai-handler-devel.cabal+1−1
@@ -1,5 +1,5 @@
1Name: wai-handler-devel
1Name: wai-handler-devel
2−Version: 0.2.0
2+Version: 0.2.0.1
3Synopsis: WAI server that automatically reloads code after modification.
3Synopsis: WAI server that automatically reloads code after modification.
4Description: This handler automatically reloads your source code upon any changes. It works by using the hint package, essentially embedding GHC inside the handler. The handler (both the executable and library) takes three arguments: the port to listen on, the module name containing the application function, and the name of the function.
4Description: This handler automatically reloads your source code upon any changes. It works by using the hint package, essentially embedding GHC inside the handler. The handler (both the executable and library) takes three arguments: the port to listen on, the module name containing the application function, and the name of the function.
5 .
5 .