{-# LANGUAGE ExistentialQuantification #-}

module Dormouse.Uri.Exception
  ( UriException(..)
  ) where

import Control.Exception.Safe (Exception(..))
import qualified Data.Text as T

-- | 'UriException' is used to indicate an error parsing a URI
newtype UriException = UriException  { UriException -> Text
uriExceptionMessage :: T.Text }

instance Show UriException where
  show :: UriException -> String
show UriException { uriExceptionMessage :: UriException -> Text
uriExceptionMessage = Text
msg } = String
"Failed to parse uri: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Text -> String
T.unpack Text
msg

instance Exception UriException