{-# LANGUAGE LambdaCase #-}

module Cardano.CLI.Types.Errors.AddressInfoError
  ( AddressInfoError (..)
  )
where

import           Cardano.Api

import           Data.Text (Text)

newtype AddressInfoError = ShelleyAddressInvalid Text
  deriving Int -> AddressInfoError -> ShowS
[AddressInfoError] -> ShowS
AddressInfoError -> String
(Int -> AddressInfoError -> ShowS)
-> (AddressInfoError -> String)
-> ([AddressInfoError] -> ShowS)
-> Show AddressInfoError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AddressInfoError -> ShowS
showsPrec :: Int -> AddressInfoError -> ShowS
$cshow :: AddressInfoError -> String
show :: AddressInfoError -> String
$cshowList :: [AddressInfoError] -> ShowS
showList :: [AddressInfoError] -> ShowS
Show

instance Error AddressInfoError where
  prettyError :: forall ann. AddressInfoError -> Doc ann
prettyError = \case
    ShelleyAddressInvalid Text
addrTxt ->
      Doc ann
"Invalid address: " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Text -> Doc ann
forall a ann. Show a => a -> Doc ann
pshow Text
addrTxt