module Yesod.Session.Storage.Exceptions
  ( StorageException (..)
  ) where

import Internal.Prelude

-- | Common exceptions that may be thrown by any storage.
data StorageException
  = -- | Thrown when attempting to insert a new session and
    --   another session with the same key already exists
    SessionAlreadyExists
  | -- | Thrown when attempting to replace an existing session
    --   but no session with the same key exists
    SessionDoesNotExist
  deriving stock (StorageException -> StorageException -> Bool
(StorageException -> StorageException -> Bool)
-> (StorageException -> StorageException -> Bool)
-> Eq StorageException
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: StorageException -> StorageException -> Bool
== :: StorageException -> StorageException -> Bool
$c/= :: StorageException -> StorageException -> Bool
/= :: StorageException -> StorageException -> Bool
Eq, Int -> StorageException -> ShowS
[StorageException] -> ShowS
StorageException -> String
(Int -> StorageException -> ShowS)
-> (StorageException -> String)
-> ([StorageException] -> ShowS)
-> Show StorageException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StorageException -> ShowS
showsPrec :: Int -> StorageException -> ShowS
$cshow :: StorageException -> String
show :: StorageException -> String
$cshowList :: [StorageException] -> ShowS
showList :: [StorageException] -> ShowS
Show)
  deriving anyclass (Show StorageException
Typeable StorageException
(Typeable StorageException, Show StorageException) =>
(StorageException -> SomeException)
-> (SomeException -> Maybe StorageException)
-> (StorageException -> String)
-> Exception StorageException
SomeException -> Maybe StorageException
StorageException -> String
StorageException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: StorageException -> SomeException
toException :: StorageException -> SomeException
$cfromException :: SomeException -> Maybe StorageException
fromException :: SomeException -> Maybe StorageException
$cdisplayException :: StorageException -> String
displayException :: StorageException -> String
Exception)