{-# LANGUAGE DeriveAnyClass #-}
module Arbiter.Core.Exceptions
(
JobException (..)
, JobRetryableException (..)
, JobPermanentException (..)
, TreeCancelException (..)
, BranchCancelException (..)
, ParsingException (..)
, InternalException (..)
, JobNotFoundException (..)
, JobStolenException (..)
, throwRetryable
, throwPermanent
, throwTreeCancel
, throwBranchCancel
, throwParsing
, throwInternal
, throwJobNotFound
, throwJobStolen
) where
import Control.Exception (Exception)
import Control.Exception qualified as E
import Control.Monad.IO.Class (MonadIO, liftIO)
import Data.Text (Text)
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import UnliftIO (MonadUnliftIO)
import UnliftIO.Exception qualified as UE
data JobException
= Retryable JobRetryableException
| Permanent JobPermanentException
| ParseFailure ParsingException
|
TreeCancel TreeCancelException
|
BranchCancel BranchCancelException
| JobNotFound JobNotFoundException
| JobStolen JobStolenException
deriving stock (Int -> JobException -> ShowS
[JobException] -> ShowS
JobException -> String
(Int -> JobException -> ShowS)
-> (JobException -> String)
-> ([JobException] -> ShowS)
-> Show JobException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> JobException -> ShowS
showsPrec :: Int -> JobException -> ShowS
$cshow :: JobException -> String
show :: JobException -> String
$cshowList :: [JobException] -> ShowS
showList :: [JobException] -> ShowS
Show, Typeable)
deriving anyclass (Show JobException
Typeable JobException
(Typeable JobException, Show JobException) =>
(JobException -> SomeException)
-> (SomeException -> Maybe JobException)
-> (JobException -> String)
-> (JobException -> Bool)
-> Exception JobException
SomeException -> Maybe JobException
JobException -> Bool
JobException -> String
JobException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e)
-> (e -> String)
-> (e -> Bool)
-> Exception e
$ctoException :: JobException -> SomeException
toException :: JobException -> SomeException
$cfromException :: SomeException -> Maybe JobException
fromException :: SomeException -> Maybe JobException
$cdisplayException :: JobException -> String
displayException :: JobException -> String
$cbacktraceDesired :: JobException -> Bool
backtraceDesired :: JobException -> Bool
Exception)
newtype JobRetryableException = JobRetryableException Text
deriving stock (JobRetryableException -> JobRetryableException -> Bool
(JobRetryableException -> JobRetryableException -> Bool)
-> (JobRetryableException -> JobRetryableException -> Bool)
-> Eq JobRetryableException
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JobRetryableException -> JobRetryableException -> Bool
== :: JobRetryableException -> JobRetryableException -> Bool
$c/= :: JobRetryableException -> JobRetryableException -> Bool
/= :: JobRetryableException -> JobRetryableException -> Bool
Eq, (forall x. JobRetryableException -> Rep JobRetryableException x)
-> (forall x. Rep JobRetryableException x -> JobRetryableException)
-> Generic JobRetryableException
forall x. Rep JobRetryableException x -> JobRetryableException
forall x. JobRetryableException -> Rep JobRetryableException x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. JobRetryableException -> Rep JobRetryableException x
from :: forall x. JobRetryableException -> Rep JobRetryableException x
$cto :: forall x. Rep JobRetryableException x -> JobRetryableException
to :: forall x. Rep JobRetryableException x -> JobRetryableException
Generic, Int -> JobRetryableException -> ShowS
[JobRetryableException] -> ShowS
JobRetryableException -> String
(Int -> JobRetryableException -> ShowS)
-> (JobRetryableException -> String)
-> ([JobRetryableException] -> ShowS)
-> Show JobRetryableException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> JobRetryableException -> ShowS
showsPrec :: Int -> JobRetryableException -> ShowS
$cshow :: JobRetryableException -> String
show :: JobRetryableException -> String
$cshowList :: [JobRetryableException] -> ShowS
showList :: [JobRetryableException] -> ShowS
Show, Typeable)
deriving anyclass (Show JobRetryableException
Typeable JobRetryableException
(Typeable JobRetryableException, Show JobRetryableException) =>
(JobRetryableException -> SomeException)
-> (SomeException -> Maybe JobRetryableException)
-> (JobRetryableException -> String)
-> (JobRetryableException -> Bool)
-> Exception JobRetryableException
SomeException -> Maybe JobRetryableException
JobRetryableException -> Bool
JobRetryableException -> String
JobRetryableException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e)
-> (e -> String)
-> (e -> Bool)
-> Exception e
$ctoException :: JobRetryableException -> SomeException
toException :: JobRetryableException -> SomeException
$cfromException :: SomeException -> Maybe JobRetryableException
fromException :: SomeException -> Maybe JobRetryableException
$cdisplayException :: JobRetryableException -> String
displayException :: JobRetryableException -> String
$cbacktraceDesired :: JobRetryableException -> Bool
backtraceDesired :: JobRetryableException -> Bool
Exception)
newtype JobPermanentException = JobPermanentException Text
deriving stock (JobPermanentException -> JobPermanentException -> Bool
(JobPermanentException -> JobPermanentException -> Bool)
-> (JobPermanentException -> JobPermanentException -> Bool)
-> Eq JobPermanentException
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JobPermanentException -> JobPermanentException -> Bool
== :: JobPermanentException -> JobPermanentException -> Bool
$c/= :: JobPermanentException -> JobPermanentException -> Bool
/= :: JobPermanentException -> JobPermanentException -> Bool
Eq, (forall x. JobPermanentException -> Rep JobPermanentException x)
-> (forall x. Rep JobPermanentException x -> JobPermanentException)
-> Generic JobPermanentException
forall x. Rep JobPermanentException x -> JobPermanentException
forall x. JobPermanentException -> Rep JobPermanentException x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. JobPermanentException -> Rep JobPermanentException x
from :: forall x. JobPermanentException -> Rep JobPermanentException x
$cto :: forall x. Rep JobPermanentException x -> JobPermanentException
to :: forall x. Rep JobPermanentException x -> JobPermanentException
Generic, Int -> JobPermanentException -> ShowS
[JobPermanentException] -> ShowS
JobPermanentException -> String
(Int -> JobPermanentException -> ShowS)
-> (JobPermanentException -> String)
-> ([JobPermanentException] -> ShowS)
-> Show JobPermanentException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> JobPermanentException -> ShowS
showsPrec :: Int -> JobPermanentException -> ShowS
$cshow :: JobPermanentException -> String
show :: JobPermanentException -> String
$cshowList :: [JobPermanentException] -> ShowS
showList :: [JobPermanentException] -> ShowS
Show, Typeable)
deriving anyclass (Show JobPermanentException
Typeable JobPermanentException
(Typeable JobPermanentException, Show JobPermanentException) =>
(JobPermanentException -> SomeException)
-> (SomeException -> Maybe JobPermanentException)
-> (JobPermanentException -> String)
-> (JobPermanentException -> Bool)
-> Exception JobPermanentException
SomeException -> Maybe JobPermanentException
JobPermanentException -> Bool
JobPermanentException -> String
JobPermanentException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e)
-> (e -> String)
-> (e -> Bool)
-> Exception e
$ctoException :: JobPermanentException -> SomeException
toException :: JobPermanentException -> SomeException
$cfromException :: SomeException -> Maybe JobPermanentException
fromException :: SomeException -> Maybe JobPermanentException
$cdisplayException :: JobPermanentException -> String
displayException :: JobPermanentException -> String
$cbacktraceDesired :: JobPermanentException -> Bool
backtraceDesired :: JobPermanentException -> Bool
Exception)
throwRetryable :: (MonadUnliftIO m) => Text -> m a
throwRetryable :: forall (m :: * -> *) a. MonadUnliftIO m => Text -> m a
throwRetryable Text
msg = JobException -> m a
forall (m :: * -> *) e a. (MonadIO m, Exception e) => e -> m a
UE.throwIO (JobRetryableException -> JobException
Retryable (Text -> JobRetryableException
JobRetryableException Text
msg))
throwPermanent :: (MonadUnliftIO m) => Text -> m a
throwPermanent :: forall (m :: * -> *) a. MonadUnliftIO m => Text -> m a
throwPermanent Text
msg = JobException -> m a
forall (m :: * -> *) e a. (MonadIO m, Exception e) => e -> m a
UE.throwIO (JobPermanentException -> JobException
Permanent (Text -> JobPermanentException
JobPermanentException Text
msg))
newtype TreeCancelException = TreeCancelException Text
deriving stock (TreeCancelException -> TreeCancelException -> Bool
(TreeCancelException -> TreeCancelException -> Bool)
-> (TreeCancelException -> TreeCancelException -> Bool)
-> Eq TreeCancelException
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TreeCancelException -> TreeCancelException -> Bool
== :: TreeCancelException -> TreeCancelException -> Bool
$c/= :: TreeCancelException -> TreeCancelException -> Bool
/= :: TreeCancelException -> TreeCancelException -> Bool
Eq, (forall x. TreeCancelException -> Rep TreeCancelException x)
-> (forall x. Rep TreeCancelException x -> TreeCancelException)
-> Generic TreeCancelException
forall x. Rep TreeCancelException x -> TreeCancelException
forall x. TreeCancelException -> Rep TreeCancelException x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TreeCancelException -> Rep TreeCancelException x
from :: forall x. TreeCancelException -> Rep TreeCancelException x
$cto :: forall x. Rep TreeCancelException x -> TreeCancelException
to :: forall x. Rep TreeCancelException x -> TreeCancelException
Generic, Int -> TreeCancelException -> ShowS
[TreeCancelException] -> ShowS
TreeCancelException -> String
(Int -> TreeCancelException -> ShowS)
-> (TreeCancelException -> String)
-> ([TreeCancelException] -> ShowS)
-> Show TreeCancelException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TreeCancelException -> ShowS
showsPrec :: Int -> TreeCancelException -> ShowS
$cshow :: TreeCancelException -> String
show :: TreeCancelException -> String
$cshowList :: [TreeCancelException] -> ShowS
showList :: [TreeCancelException] -> ShowS
Show, Typeable)
deriving anyclass (Show TreeCancelException
Typeable TreeCancelException
(Typeable TreeCancelException, Show TreeCancelException) =>
(TreeCancelException -> SomeException)
-> (SomeException -> Maybe TreeCancelException)
-> (TreeCancelException -> String)
-> (TreeCancelException -> Bool)
-> Exception TreeCancelException
SomeException -> Maybe TreeCancelException
TreeCancelException -> Bool
TreeCancelException -> String
TreeCancelException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e)
-> (e -> String)
-> (e -> Bool)
-> Exception e
$ctoException :: TreeCancelException -> SomeException
toException :: TreeCancelException -> SomeException
$cfromException :: SomeException -> Maybe TreeCancelException
fromException :: SomeException -> Maybe TreeCancelException
$cdisplayException :: TreeCancelException -> String
displayException :: TreeCancelException -> String
$cbacktraceDesired :: TreeCancelException -> Bool
backtraceDesired :: TreeCancelException -> Bool
Exception)
newtype BranchCancelException = BranchCancelException Text
deriving stock (BranchCancelException -> BranchCancelException -> Bool
(BranchCancelException -> BranchCancelException -> Bool)
-> (BranchCancelException -> BranchCancelException -> Bool)
-> Eq BranchCancelException
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BranchCancelException -> BranchCancelException -> Bool
== :: BranchCancelException -> BranchCancelException -> Bool
$c/= :: BranchCancelException -> BranchCancelException -> Bool
/= :: BranchCancelException -> BranchCancelException -> Bool
Eq, (forall x. BranchCancelException -> Rep BranchCancelException x)
-> (forall x. Rep BranchCancelException x -> BranchCancelException)
-> Generic BranchCancelException
forall x. Rep BranchCancelException x -> BranchCancelException
forall x. BranchCancelException -> Rep BranchCancelException x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. BranchCancelException -> Rep BranchCancelException x
from :: forall x. BranchCancelException -> Rep BranchCancelException x
$cto :: forall x. Rep BranchCancelException x -> BranchCancelException
to :: forall x. Rep BranchCancelException x -> BranchCancelException
Generic, Int -> BranchCancelException -> ShowS
[BranchCancelException] -> ShowS
BranchCancelException -> String
(Int -> BranchCancelException -> ShowS)
-> (BranchCancelException -> String)
-> ([BranchCancelException] -> ShowS)
-> Show BranchCancelException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BranchCancelException -> ShowS
showsPrec :: Int -> BranchCancelException -> ShowS
$cshow :: BranchCancelException -> String
show :: BranchCancelException -> String
$cshowList :: [BranchCancelException] -> ShowS
showList :: [BranchCancelException] -> ShowS
Show, Typeable)
deriving anyclass (Show BranchCancelException
Typeable BranchCancelException
(Typeable BranchCancelException, Show BranchCancelException) =>
(BranchCancelException -> SomeException)
-> (SomeException -> Maybe BranchCancelException)
-> (BranchCancelException -> String)
-> (BranchCancelException -> Bool)
-> Exception BranchCancelException
SomeException -> Maybe BranchCancelException
BranchCancelException -> Bool
BranchCancelException -> String
BranchCancelException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e)
-> (e -> String)
-> (e -> Bool)
-> Exception e
$ctoException :: BranchCancelException -> SomeException
toException :: BranchCancelException -> SomeException
$cfromException :: SomeException -> Maybe BranchCancelException
fromException :: SomeException -> Maybe BranchCancelException
$cdisplayException :: BranchCancelException -> String
displayException :: BranchCancelException -> String
$cbacktraceDesired :: BranchCancelException -> Bool
backtraceDesired :: BranchCancelException -> Bool
Exception)
throwTreeCancel :: (MonadUnliftIO m) => Text -> m a
throwTreeCancel :: forall (m :: * -> *) a. MonadUnliftIO m => Text -> m a
throwTreeCancel Text
msg = JobException -> m a
forall (m :: * -> *) e a. (MonadIO m, Exception e) => e -> m a
UE.throwIO (TreeCancelException -> JobException
TreeCancel (Text -> TreeCancelException
TreeCancelException Text
msg))
throwBranchCancel :: (MonadUnliftIO m) => Text -> m a
throwBranchCancel :: forall (m :: * -> *) a. MonadUnliftIO m => Text -> m a
throwBranchCancel Text
msg = JobException -> m a
forall (m :: * -> *) e a. (MonadIO m, Exception e) => e -> m a
UE.throwIO (BranchCancelException -> JobException
BranchCancel (Text -> BranchCancelException
BranchCancelException Text
msg))
newtype ParsingException = ParsingException Text
deriving stock (ParsingException -> ParsingException -> Bool
(ParsingException -> ParsingException -> Bool)
-> (ParsingException -> ParsingException -> Bool)
-> Eq ParsingException
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ParsingException -> ParsingException -> Bool
== :: ParsingException -> ParsingException -> Bool
$c/= :: ParsingException -> ParsingException -> Bool
/= :: ParsingException -> ParsingException -> Bool
Eq, (forall x. ParsingException -> Rep ParsingException x)
-> (forall x. Rep ParsingException x -> ParsingException)
-> Generic ParsingException
forall x. Rep ParsingException x -> ParsingException
forall x. ParsingException -> Rep ParsingException x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ParsingException -> Rep ParsingException x
from :: forall x. ParsingException -> Rep ParsingException x
$cto :: forall x. Rep ParsingException x -> ParsingException
to :: forall x. Rep ParsingException x -> ParsingException
Generic, Int -> ParsingException -> ShowS
[ParsingException] -> ShowS
ParsingException -> String
(Int -> ParsingException -> ShowS)
-> (ParsingException -> String)
-> ([ParsingException] -> ShowS)
-> Show ParsingException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ParsingException -> ShowS
showsPrec :: Int -> ParsingException -> ShowS
$cshow :: ParsingException -> String
show :: ParsingException -> String
$cshowList :: [ParsingException] -> ShowS
showList :: [ParsingException] -> ShowS
Show, Typeable)
deriving anyclass (Show ParsingException
Typeable ParsingException
(Typeable ParsingException, Show ParsingException) =>
(ParsingException -> SomeException)
-> (SomeException -> Maybe ParsingException)
-> (ParsingException -> String)
-> (ParsingException -> Bool)
-> Exception ParsingException
SomeException -> Maybe ParsingException
ParsingException -> Bool
ParsingException -> String
ParsingException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e)
-> (e -> String)
-> (e -> Bool)
-> Exception e
$ctoException :: ParsingException -> SomeException
toException :: ParsingException -> SomeException
$cfromException :: SomeException -> Maybe ParsingException
fromException :: SomeException -> Maybe ParsingException
$cdisplayException :: ParsingException -> String
displayException :: ParsingException -> String
$cbacktraceDesired :: ParsingException -> Bool
backtraceDesired :: ParsingException -> Bool
Exception)
throwParsing :: (MonadIO m) => Text -> m a
throwParsing :: forall (m :: * -> *) a. MonadIO m => Text -> m a
throwParsing Text
msg = IO a -> m a
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> m a) -> IO a -> m a
forall a b. (a -> b) -> a -> b
$ JobException -> IO a
forall e a. (HasCallStack, Exception e) => e -> IO a
E.throwIO (ParsingException -> JobException
ParseFailure (Text -> ParsingException
ParsingException Text
msg))
newtype InternalException = InternalException Text
deriving stock (InternalException -> InternalException -> Bool
(InternalException -> InternalException -> Bool)
-> (InternalException -> InternalException -> Bool)
-> Eq InternalException
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InternalException -> InternalException -> Bool
== :: InternalException -> InternalException -> Bool
$c/= :: InternalException -> InternalException -> Bool
/= :: InternalException -> InternalException -> Bool
Eq, (forall x. InternalException -> Rep InternalException x)
-> (forall x. Rep InternalException x -> InternalException)
-> Generic InternalException
forall x. Rep InternalException x -> InternalException
forall x. InternalException -> Rep InternalException x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. InternalException -> Rep InternalException x
from :: forall x. InternalException -> Rep InternalException x
$cto :: forall x. Rep InternalException x -> InternalException
to :: forall x. Rep InternalException x -> InternalException
Generic, Int -> InternalException -> ShowS
[InternalException] -> ShowS
InternalException -> String
(Int -> InternalException -> ShowS)
-> (InternalException -> String)
-> ([InternalException] -> ShowS)
-> Show InternalException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InternalException -> ShowS
showsPrec :: Int -> InternalException -> ShowS
$cshow :: InternalException -> String
show :: InternalException -> String
$cshowList :: [InternalException] -> ShowS
showList :: [InternalException] -> ShowS
Show, Typeable)
deriving anyclass (Show InternalException
Typeable InternalException
(Typeable InternalException, Show InternalException) =>
(InternalException -> SomeException)
-> (SomeException -> Maybe InternalException)
-> (InternalException -> String)
-> (InternalException -> Bool)
-> Exception InternalException
SomeException -> Maybe InternalException
InternalException -> Bool
InternalException -> String
InternalException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e)
-> (e -> String)
-> (e -> Bool)
-> Exception e
$ctoException :: InternalException -> SomeException
toException :: InternalException -> SomeException
$cfromException :: SomeException -> Maybe InternalException
fromException :: SomeException -> Maybe InternalException
$cdisplayException :: InternalException -> String
displayException :: InternalException -> String
$cbacktraceDesired :: InternalException -> Bool
backtraceDesired :: InternalException -> Bool
Exception)
throwInternal :: (MonadIO m) => Text -> m a
throwInternal :: forall (m :: * -> *) a. MonadIO m => Text -> m a
throwInternal Text
msg = IO a -> m a
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> m a) -> IO a -> m a
forall a b. (a -> b) -> a -> b
$ InternalException -> IO a
forall e a. (HasCallStack, Exception e) => e -> IO a
E.throwIO (Text -> InternalException
InternalException Text
msg)
newtype JobNotFoundException = JobNotFoundException Text
deriving stock (JobNotFoundException -> JobNotFoundException -> Bool
(JobNotFoundException -> JobNotFoundException -> Bool)
-> (JobNotFoundException -> JobNotFoundException -> Bool)
-> Eq JobNotFoundException
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JobNotFoundException -> JobNotFoundException -> Bool
== :: JobNotFoundException -> JobNotFoundException -> Bool
$c/= :: JobNotFoundException -> JobNotFoundException -> Bool
/= :: JobNotFoundException -> JobNotFoundException -> Bool
Eq, (forall x. JobNotFoundException -> Rep JobNotFoundException x)
-> (forall x. Rep JobNotFoundException x -> JobNotFoundException)
-> Generic JobNotFoundException
forall x. Rep JobNotFoundException x -> JobNotFoundException
forall x. JobNotFoundException -> Rep JobNotFoundException x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. JobNotFoundException -> Rep JobNotFoundException x
from :: forall x. JobNotFoundException -> Rep JobNotFoundException x
$cto :: forall x. Rep JobNotFoundException x -> JobNotFoundException
to :: forall x. Rep JobNotFoundException x -> JobNotFoundException
Generic, Int -> JobNotFoundException -> ShowS
[JobNotFoundException] -> ShowS
JobNotFoundException -> String
(Int -> JobNotFoundException -> ShowS)
-> (JobNotFoundException -> String)
-> ([JobNotFoundException] -> ShowS)
-> Show JobNotFoundException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> JobNotFoundException -> ShowS
showsPrec :: Int -> JobNotFoundException -> ShowS
$cshow :: JobNotFoundException -> String
show :: JobNotFoundException -> String
$cshowList :: [JobNotFoundException] -> ShowS
showList :: [JobNotFoundException] -> ShowS
Show, Typeable)
deriving anyclass (Show JobNotFoundException
Typeable JobNotFoundException
(Typeable JobNotFoundException, Show JobNotFoundException) =>
(JobNotFoundException -> SomeException)
-> (SomeException -> Maybe JobNotFoundException)
-> (JobNotFoundException -> String)
-> (JobNotFoundException -> Bool)
-> Exception JobNotFoundException
SomeException -> Maybe JobNotFoundException
JobNotFoundException -> Bool
JobNotFoundException -> String
JobNotFoundException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e)
-> (e -> String)
-> (e -> Bool)
-> Exception e
$ctoException :: JobNotFoundException -> SomeException
toException :: JobNotFoundException -> SomeException
$cfromException :: SomeException -> Maybe JobNotFoundException
fromException :: SomeException -> Maybe JobNotFoundException
$cdisplayException :: JobNotFoundException -> String
displayException :: JobNotFoundException -> String
$cbacktraceDesired :: JobNotFoundException -> Bool
backtraceDesired :: JobNotFoundException -> Bool
Exception)
throwJobNotFound :: (MonadUnliftIO m) => Text -> m a
throwJobNotFound :: forall (m :: * -> *) a. MonadUnliftIO m => Text -> m a
throwJobNotFound Text
msg = JobException -> m a
forall (m :: * -> *) e a. (MonadIO m, Exception e) => e -> m a
UE.throwIO (JobNotFoundException -> JobException
JobNotFound (Text -> JobNotFoundException
JobNotFoundException Text
msg))
newtype JobStolenException = JobStolenException Text
deriving stock (JobStolenException -> JobStolenException -> Bool
(JobStolenException -> JobStolenException -> Bool)
-> (JobStolenException -> JobStolenException -> Bool)
-> Eq JobStolenException
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JobStolenException -> JobStolenException -> Bool
== :: JobStolenException -> JobStolenException -> Bool
$c/= :: JobStolenException -> JobStolenException -> Bool
/= :: JobStolenException -> JobStolenException -> Bool
Eq, (forall x. JobStolenException -> Rep JobStolenException x)
-> (forall x. Rep JobStolenException x -> JobStolenException)
-> Generic JobStolenException
forall x. Rep JobStolenException x -> JobStolenException
forall x. JobStolenException -> Rep JobStolenException x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. JobStolenException -> Rep JobStolenException x
from :: forall x. JobStolenException -> Rep JobStolenException x
$cto :: forall x. Rep JobStolenException x -> JobStolenException
to :: forall x. Rep JobStolenException x -> JobStolenException
Generic, Int -> JobStolenException -> ShowS
[JobStolenException] -> ShowS
JobStolenException -> String
(Int -> JobStolenException -> ShowS)
-> (JobStolenException -> String)
-> ([JobStolenException] -> ShowS)
-> Show JobStolenException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> JobStolenException -> ShowS
showsPrec :: Int -> JobStolenException -> ShowS
$cshow :: JobStolenException -> String
show :: JobStolenException -> String
$cshowList :: [JobStolenException] -> ShowS
showList :: [JobStolenException] -> ShowS
Show, Typeable)
deriving anyclass (Show JobStolenException
Typeable JobStolenException
(Typeable JobStolenException, Show JobStolenException) =>
(JobStolenException -> SomeException)
-> (SomeException -> Maybe JobStolenException)
-> (JobStolenException -> String)
-> (JobStolenException -> Bool)
-> Exception JobStolenException
SomeException -> Maybe JobStolenException
JobStolenException -> Bool
JobStolenException -> String
JobStolenException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e)
-> (e -> String)
-> (e -> Bool)
-> Exception e
$ctoException :: JobStolenException -> SomeException
toException :: JobStolenException -> SomeException
$cfromException :: SomeException -> Maybe JobStolenException
fromException :: SomeException -> Maybe JobStolenException
$cdisplayException :: JobStolenException -> String
displayException :: JobStolenException -> String
$cbacktraceDesired :: JobStolenException -> Bool
backtraceDesired :: JobStolenException -> Bool
Exception)
throwJobStolen :: (MonadUnliftIO m) => Text -> m a
throwJobStolen :: forall (m :: * -> *) a. MonadUnliftIO m => Text -> m a
throwJobStolen Text
msg = JobException -> m a
forall (m :: * -> *) e a. (MonadIO m, Exception e) => e -> m a
UE.throwIO (JobStolenException -> JobException
JobStolen (Text -> JobStolenException
JobStolenException Text
msg))