hcom-0.0.0.6: Haskell COM support library
Copyright(c) 2009 Sigbjorn Finne
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainersof@forkIO.com
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

System.Win32.Com.Exception

Description

Representing and working with COM's 'exception model' (HRESULTs) in Haskell. Failures in COM method calls are mapped into Exception Haskell exceptions, providing convenient handlers to catch and throw these.

Synopsis

Documentation

catchComException :: IO a -> (Com_Exception -> IO a) -> IO a Source #

act catchComException (ex -> hdlr ex) performs the IO action act, but catches any IO or COM exceptions ex, passing them to the handler hdlr.

catch_ce_ :: IO a -> (Maybe ComException -> IO a) -> IO a Source #

type Com_Exception = Either IOException ComException Source #

Com_Exception is either an IOException or ComException; no attempt is made to embed one inside the other.

throwIOComException :: Com_Exception -> IO a Source #

throwIOComException ex raises/throws the exception ex; ex is either an IOException or a ComException.

check2HR :: HRESULT -> IO () Source #

check2HR hr triggers a COM exception if the HRESULT hr represent an error condition. The current last error value embedded in the exception gives more information about cause.

checkBool :: Int32 -> IO () Source #

checkBool mbZero raises a COM exception if mbZero is equal to...zero. The last error is embedded inside the exception.

returnHR :: IO () -> IO HRESULT Source #

returnHR act runs the IO action act, catching any COM exceptions. Success or failure is then mapped back into the corresponding HRESULT. In the case of success, s_OK.

isCoError :: Com_Exception -> Bool Source #

isCoError e returns True for COM exceptions; False for IO exception values.

coGetException :: Com_Exception -> Maybe ComException Source #

coGetException ei picks out the COM exception ei, if one.

coGetErrorHR :: Com_Exception -> Maybe HRESULT Source #

coGetException ei picks out the COM HRESULT from the exception, if any.

coGetErrorString :: Com_Exception -> String Source #

coGetException ei returns a user-friendlier representation of the ei exception.

coOnFail :: IO a -> String -> IO a Source #

coFail :: String -> IO a Source #

coFail msg raised the E_FAIL COM exception along with the descriptive string msg.

s_FALSE :: HRESULT Source #

s_OK and s_FALSE are the boolean values encoded as HRESULTs.

s_OK :: HRESULT Source #

s_OK and s_FALSE are the boolean values encoded as HRESULTs.