{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.JavaScriptCore.Objects.Exception
(
Exception(..) ,
IsException ,
toException ,
noException ,
#if defined(ENABLE_OVERLOADING)
ResolveExceptionMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ExceptionGetBacktraceStringMethodInfo ,
#endif
exceptionGetBacktraceString ,
#if defined(ENABLE_OVERLOADING)
ExceptionGetColumnNumberMethodInfo ,
#endif
exceptionGetColumnNumber ,
#if defined(ENABLE_OVERLOADING)
ExceptionGetLineNumberMethodInfo ,
#endif
exceptionGetLineNumber ,
#if defined(ENABLE_OVERLOADING)
ExceptionGetMessageMethodInfo ,
#endif
exceptionGetMessage ,
#if defined(ENABLE_OVERLOADING)
ExceptionGetNameMethodInfo ,
#endif
exceptionGetName ,
#if defined(ENABLE_OVERLOADING)
ExceptionGetSourceUriMethodInfo ,
#endif
exceptionGetSourceUri ,
exceptionNew ,
exceptionNewWithName ,
#if defined(ENABLE_OVERLOADING)
ExceptionReportMethodInfo ,
#endif
exceptionReport ,
#if defined(ENABLE_OVERLOADING)
ExceptionToStringMethodInfo ,
#endif
exceptionToString ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.JavaScriptCore.Objects.Context as JavaScriptCore.Context
newtype Exception = Exception (ManagedPtr Exception)
deriving (Exception -> Exception -> Bool
(Exception -> Exception -> Bool)
-> (Exception -> Exception -> Bool) -> Eq Exception
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Exception -> Exception -> Bool
$c/= :: Exception -> Exception -> Bool
== :: Exception -> Exception -> Bool
$c== :: Exception -> Exception -> Bool
Eq)
foreign import ccall "jsc_exception_get_type"
c_jsc_exception_get_type :: IO GType
instance GObject Exception where
gobjectType :: IO GType
gobjectType = IO GType
c_jsc_exception_get_type
instance B.GValue.IsGValue Exception where
toGValue :: Exception -> IO GValue
toGValue o :: Exception
o = do
GType
gtype <- IO GType
c_jsc_exception_get_type
Exception -> (Ptr Exception -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Exception
o (GType
-> (GValue -> Ptr Exception -> IO ()) -> Ptr Exception -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Exception -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO Exception
fromGValue gv :: GValue
gv = do
Ptr Exception
ptr <- GValue -> IO (Ptr Exception)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr Exception)
(ManagedPtr Exception -> Exception)
-> Ptr Exception -> IO Exception
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Exception -> Exception
Exception Ptr Exception
ptr
class (GObject o, O.IsDescendantOf Exception o) => IsException o
instance (GObject o, O.IsDescendantOf Exception o) => IsException o
instance O.HasParentTypes Exception
type instance O.ParentTypes Exception = '[GObject.Object.Object]
toException :: (MonadIO m, IsException o) => o -> m Exception
toException :: o -> m Exception
toException = IO Exception -> m Exception
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Exception -> m Exception)
-> (o -> IO Exception) -> o -> m Exception
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Exception -> Exception) -> o -> IO Exception
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr Exception -> Exception
Exception
noException :: Maybe Exception
noException :: Maybe Exception
noException = Maybe Exception
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveExceptionMethod (t :: Symbol) (o :: *) :: * where
ResolveExceptionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveExceptionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveExceptionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveExceptionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveExceptionMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveExceptionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveExceptionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveExceptionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveExceptionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveExceptionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveExceptionMethod "report" o = ExceptionReportMethodInfo
ResolveExceptionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveExceptionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveExceptionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveExceptionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveExceptionMethod "toString" o = ExceptionToStringMethodInfo
ResolveExceptionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveExceptionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveExceptionMethod "getBacktraceString" o = ExceptionGetBacktraceStringMethodInfo
ResolveExceptionMethod "getColumnNumber" o = ExceptionGetColumnNumberMethodInfo
ResolveExceptionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveExceptionMethod "getLineNumber" o = ExceptionGetLineNumberMethodInfo
ResolveExceptionMethod "getMessage" o = ExceptionGetMessageMethodInfo
ResolveExceptionMethod "getName" o = ExceptionGetNameMethodInfo
ResolveExceptionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveExceptionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveExceptionMethod "getSourceUri" o = ExceptionGetSourceUriMethodInfo
ResolveExceptionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveExceptionMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveExceptionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveExceptionMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveExceptionMethod t Exception, O.MethodInfo info Exception p) => OL.IsLabel t (Exception -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Exception
type instance O.AttributeList Exception = ExceptionAttributeList
type ExceptionAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Exception = ExceptionSignalList
type ExceptionSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "jsc_exception_new" jsc_exception_new ::
Ptr JavaScriptCore.Context.Context ->
CString ->
IO (Ptr Exception)
exceptionNew ::
(B.CallStack.HasCallStack, MonadIO m, JavaScriptCore.Context.IsContext a) =>
a
-> T.Text
-> m Exception
exceptionNew :: a -> Text -> m Exception
exceptionNew context :: a
context message :: Text
message = IO Exception -> m Exception
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Exception -> m Exception) -> IO Exception -> m Exception
forall a b. (a -> b) -> a -> b
$ do
Ptr Context
context' <- a -> IO (Ptr Context)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
context
CString
message' <- Text -> IO CString
textToCString Text
message
Ptr Exception
result <- Ptr Context -> CString -> IO (Ptr Exception)
jsc_exception_new Ptr Context
context' CString
message'
Text -> Ptr Exception -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "exceptionNew" Ptr Exception
result
Exception
result' <- ((ManagedPtr Exception -> Exception)
-> Ptr Exception -> IO Exception
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Exception -> Exception
Exception) Ptr Exception
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
context
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
message'
Exception -> IO Exception
forall (m :: * -> *) a. Monad m => a -> m a
return Exception
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "jsc_exception_new_with_name" jsc_exception_new_with_name ::
Ptr JavaScriptCore.Context.Context ->
CString ->
CString ->
IO (Ptr Exception)
exceptionNewWithName ::
(B.CallStack.HasCallStack, MonadIO m, JavaScriptCore.Context.IsContext a) =>
a
-> T.Text
-> T.Text
-> m Exception
exceptionNewWithName :: a -> Text -> Text -> m Exception
exceptionNewWithName context :: a
context name :: Text
name message :: Text
message = IO Exception -> m Exception
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Exception -> m Exception) -> IO Exception -> m Exception
forall a b. (a -> b) -> a -> b
$ do
Ptr Context
context' <- a -> IO (Ptr Context)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
context
CString
name' <- Text -> IO CString
textToCString Text
name
CString
message' <- Text -> IO CString
textToCString Text
message
Ptr Exception
result <- Ptr Context -> CString -> CString -> IO (Ptr Exception)
jsc_exception_new_with_name Ptr Context
context' CString
name' CString
message'
Text -> Ptr Exception -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "exceptionNewWithName" Ptr Exception
result
Exception
result' <- ((ManagedPtr Exception -> Exception)
-> Ptr Exception -> IO Exception
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Exception -> Exception
Exception) Ptr Exception
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
context
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
message'
Exception -> IO Exception
forall (m :: * -> *) a. Monad m => a -> m a
return Exception
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "jsc_exception_get_backtrace_string" jsc_exception_get_backtrace_string ::
Ptr Exception ->
IO CString
exceptionGetBacktraceString ::
(B.CallStack.HasCallStack, MonadIO m, IsException a) =>
a
-> m (Maybe T.Text)
exceptionGetBacktraceString :: a -> m (Maybe Text)
exceptionGetBacktraceString exception :: a
exception = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Exception
exception' <- a -> IO (Ptr Exception)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
exception
CString
result <- Ptr Exception -> IO CString
jsc_exception_get_backtrace_string Ptr Exception
exception'
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \result' :: CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
exception
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data ExceptionGetBacktraceStringMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsException a) => O.MethodInfo ExceptionGetBacktraceStringMethodInfo a signature where
overloadedMethod = exceptionGetBacktraceString
#endif
foreign import ccall "jsc_exception_get_column_number" jsc_exception_get_column_number ::
Ptr Exception ->
IO Word32
exceptionGetColumnNumber ::
(B.CallStack.HasCallStack, MonadIO m, IsException a) =>
a
-> m Word32
exceptionGetColumnNumber :: a -> m Word32
exceptionGetColumnNumber exception :: a
exception = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Exception
exception' <- a -> IO (Ptr Exception)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
exception
Word32
result <- Ptr Exception -> IO Word32
jsc_exception_get_column_number Ptr Exception
exception'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
exception
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data ExceptionGetColumnNumberMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsException a) => O.MethodInfo ExceptionGetColumnNumberMethodInfo a signature where
overloadedMethod = exceptionGetColumnNumber
#endif
foreign import ccall "jsc_exception_get_line_number" jsc_exception_get_line_number ::
Ptr Exception ->
IO Word32
exceptionGetLineNumber ::
(B.CallStack.HasCallStack, MonadIO m, IsException a) =>
a
-> m Word32
exceptionGetLineNumber :: a -> m Word32
exceptionGetLineNumber exception :: a
exception = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Exception
exception' <- a -> IO (Ptr Exception)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
exception
Word32
result <- Ptr Exception -> IO Word32
jsc_exception_get_line_number Ptr Exception
exception'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
exception
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data ExceptionGetLineNumberMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsException a) => O.MethodInfo ExceptionGetLineNumberMethodInfo a signature where
overloadedMethod = exceptionGetLineNumber
#endif
foreign import ccall "jsc_exception_get_message" jsc_exception_get_message ::
Ptr Exception ->
IO CString
exceptionGetMessage ::
(B.CallStack.HasCallStack, MonadIO m, IsException a) =>
a
-> m T.Text
exceptionGetMessage :: a -> m Text
exceptionGetMessage exception :: a
exception = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr Exception
exception' <- a -> IO (Ptr Exception)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
exception
CString
result <- Ptr Exception -> IO CString
jsc_exception_get_message Ptr Exception
exception'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "exceptionGetMessage" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
exception
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data ExceptionGetMessageMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsException a) => O.MethodInfo ExceptionGetMessageMethodInfo a signature where
overloadedMethod = exceptionGetMessage
#endif
foreign import ccall "jsc_exception_get_name" jsc_exception_get_name ::
Ptr Exception ->
IO CString
exceptionGetName ::
(B.CallStack.HasCallStack, MonadIO m, IsException a) =>
a
-> m T.Text
exceptionGetName :: a -> m Text
exceptionGetName exception :: a
exception = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr Exception
exception' <- a -> IO (Ptr Exception)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
exception
CString
result <- Ptr Exception -> IO CString
jsc_exception_get_name Ptr Exception
exception'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "exceptionGetName" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
exception
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data ExceptionGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsException a) => O.MethodInfo ExceptionGetNameMethodInfo a signature where
overloadedMethod = exceptionGetName
#endif
foreign import ccall "jsc_exception_get_source_uri" jsc_exception_get_source_uri ::
Ptr Exception ->
IO CString
exceptionGetSourceUri ::
(B.CallStack.HasCallStack, MonadIO m, IsException a) =>
a
-> m (Maybe T.Text)
exceptionGetSourceUri :: a -> m (Maybe Text)
exceptionGetSourceUri exception :: a
exception = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Exception
exception' <- a -> IO (Ptr Exception)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
exception
CString
result <- Ptr Exception -> IO CString
jsc_exception_get_source_uri Ptr Exception
exception'
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \result' :: CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
exception
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data ExceptionGetSourceUriMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsException a) => O.MethodInfo ExceptionGetSourceUriMethodInfo a signature where
overloadedMethod = exceptionGetSourceUri
#endif
foreign import ccall "jsc_exception_report" jsc_exception_report ::
Ptr Exception ->
IO CString
exceptionReport ::
(B.CallStack.HasCallStack, MonadIO m, IsException a) =>
a
-> m T.Text
exceptionReport :: a -> m Text
exceptionReport exception :: a
exception = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr Exception
exception' <- a -> IO (Ptr Exception)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
exception
CString
result <- Ptr Exception -> IO CString
jsc_exception_report Ptr Exception
exception'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "exceptionReport" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
exception
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data ExceptionReportMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsException a) => O.MethodInfo ExceptionReportMethodInfo a signature where
overloadedMethod = exceptionReport
#endif
foreign import ccall "jsc_exception_to_string" jsc_exception_to_string ::
Ptr Exception ->
IO CString
exceptionToString ::
(B.CallStack.HasCallStack, MonadIO m, IsException a) =>
a
-> m T.Text
exceptionToString :: a -> m Text
exceptionToString exception :: a
exception = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr Exception
exception' <- a -> IO (Ptr Exception)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
exception
CString
result <- Ptr Exception -> IO CString
jsc_exception_to_string Ptr Exception
exception'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "exceptionToString" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
exception
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data ExceptionToStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsException a) => O.MethodInfo ExceptionToStringMethodInfo a signature where
overloadedMethod = exceptionToString
#endif