This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap".

The branch, master has been updated
       via  f21befeb446744e5ca29e3d89c687779f3897d81 (commit)
      from  d100331c73dd9a9346e10f7e00d274262fa61ea8 (commit)


Summary of changes:
 src/Snap/Error.hs |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f21befeb446744e5ca29e3d89c687779f3897d81
Author: Carl Howells <[email protected]>
Date:   Thu Jul 1 16:32:48 2010 -0700

    Cleanups and docs for Error.Snap

diff --git a/src/Snap/Error.hs b/src/Snap/Error.hs
index 98bb463..3bfb2f1 100644
--- a/src/Snap/Error.hs
+++ b/src/Snap/Error.hs
@@ -1,10 +1,9 @@
 {-# LANGUAGE OverloadedStrings #-}
-module Snap.Error (
-    catch500
-  , internalError
-)
-where
+-- | This module contains a couple simple functions for helping Snap
+-- applications deal with errors.
+module Snap.Error where
 
+------------------------------------------------------------------------------
 import           Control.Exception (SomeException)
 import           Control.Monad.CatchIO
 
@@ -12,9 +11,15 @@ import           Prelude hiding (catch)
 
 import qualified Data.ByteString.Char8 as S
 
+------------------------------------------------------------------------------
 import           Snap.Iteratee
 import           Snap.Types
 
+
+------------------------------------------------------------------------------
+-- | This function creates a simple plain text error page with the
+-- provided content.  It sets the response status to 500, and
+-- short-circuits further handling of the request
 internalError :: (MonadSnap m) => S.ByteString -> m a
 internalError msg =
     let rsp = setContentType "text/plain; charset=utf-8"
@@ -25,10 +30,15 @@ internalError msg =
 
     in finishWith rsp
 
+
+------------------------------------------------------------------------------
+-- | This function wraps a 'MonadSnap' handler so that if any
+-- exceptions escape from it, the exception is rendered as an error
+-- page and not propogated any further.
 catch500 :: (MonadSnap m) => m a -> m a
 catch500 action = action `catch` handler
   where
-    handler :: (MonadSnap m) => SomeException -> m a'
+    handler :: (MonadSnap m) => SomeException -> m a
     handler = internalError
             . S.append "Unhandled error:\r\n\r\n"
             . S.pack
-----------------------------------------------------------------------


hooks/post-receive
-- 
snap
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to