on master help sign in
Prettier error messages
commit069651e097b90c7d34a61b89a9cf99c60674ab90 authorMichael Snoyman <michael@snoyman.com> dateSun 6 Feb 2011, 16:52 (16 years ago) parentb49fe41
2 files changed+6−3
Network/Wai/Handler/DevelServer.hs+5−2 wai-handler-devel.cabal+1−1
Network/Wai/Handler/DevelServer.hs+5−2
@@ -15,7 +15,7 @@ import Network.Wai
1515import Data.Text.Lazy (pack)
1616import Data.Text.Lazy.Encoding (encodeUtf8)
1717import qualified Data.ByteString.Lazy.Char8 as L8
18−import Control.Exception (Exception, SomeException, toException)
18+import Control.Exception (Exception, SomeException, toException, fromException)
1919import qualified Control.Exception as E
2020import Control.Concurrent (forkIO, threadDelay)
2121
@@ -151,7 +151,10 @@ loadingApp err f =
151151 ) $ toMessage err
152152 where
153153 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')
155158
156159charsToLBS :: String -> L8.ByteString
157160charsToLBS = encodeUtf8 . pack
wai-handler-devel.cabal+1−1
@@ -1,5 +1,5 @@
11Name: wai-handler-devel
2−Version: 0.2.0
2+Version: 0.2.0.1
33Synopsis: WAI server that automatically reloads code after modification.
44Description: 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.
55 .