{-# LANGUAGE UndecidableInstances #-}

module Effectful.Notify.Internal.Data.NotifyInitException
  ( NotifyInitException (..),
  )
where

import Control.Exception (Exception (displayException), SomeException)

-- | Exceptions thrown when initializing notifications.
--
-- @since 0.1
newtype NotifyInitException = MkNotifyInitException
  { NotifyInitException -> SomeException
unNotifyInitException :: SomeException
  }

-- | @since 0.1
deriving stock instance Show NotifyInitException

-- | @since 0.1
instance Exception NotifyInitException where
  displayException :: NotifyInitException -> String
displayException NotifyInitException
ex =
    [String] -> String
forall a. Monoid a => [a] -> a
mconcat
      [ String
"Exception initializing notifications: ",
        NotifyInitException -> String
forall e. Exception e => e -> String
displayException NotifyInitException
ex
      ]