[project @ 2002-03-11 14:53:51 by simonmar]
[ghc-base.git] / Control / Exception.hs
index 041b222..0248ff2 100644 (file)
@@ -8,7 +8,7 @@
 -- Stability   :  experimental
 -- Portability :  non-portable
 --
--- $Id: Exception.hs,v 1.2 2001/07/31 14:34:23 simonmar Exp $
+-- $Id: Exception.hs,v 1.6 2002/02/05 17:32:25 simonmar Exp $
 --
 -- The External API for exceptions.  The functions provided in this
 -- module allow catching of exceptions in the IO monad.
@@ -47,10 +47,7 @@ module Control.Exception (
        -- Throwing exceptions
 
        throw,          -- :: Exception -> a
-#ifndef __STGHUGS__
-       -- for now
        throwTo,        -- :: ThreadId -> Exception -> a
-#endif
 
        -- Dynamic exceptions
 
@@ -79,7 +76,8 @@ module Control.Exception (
 
 #ifdef __GLASGOW_HASKELL__
 import Prelude                 hiding (catch)
-import GHC.Prim                ( assert )
+import System.IO.Error
+import GHC.Base                ( assert )
 import GHC.Exception   hiding (try, catch, bracket, bracket_)
 import GHC.Conc                ( throwTo, ThreadId )
 import GHC.IOBase      ( IO(..) )
@@ -202,7 +200,7 @@ dynExceptions _ = Nothing
 asyncExceptions (AsyncException e) = Just e
 asyncExceptions _ = Nothing
 
-userErrors (UserError e) = Just e
+userErrors e | isUserError e = Just (ioeGetErrorString e)
 userErrors _ = Nothing
 
 -----------------------------------------------------------------------------