{-# LANGUAGE TemplateHaskell #-}

-- | Command errors
module CalamityCommands.Error (CommandError (..)) where

import Data.Text qualified as T
import TextShow.TH (deriveTextShow)

data CommandError
  = ParseError
      -- | The type of the parser
      T.Text
      -- | The reason that parsing failed
      T.Text
  | CheckError
      -- | The name of the check that failed
      T.Text
      -- | The reason for the check failing
      T.Text
  | InvokeError
      -- | The name of the command that failed
      T.Text
      -- | The reason for failing
      T.Text
  deriving (Int -> CommandError -> ShowS
[CommandError] -> ShowS
CommandError -> String
(Int -> CommandError -> ShowS)
-> (CommandError -> String)
-> ([CommandError] -> ShowS)
-> Show CommandError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CommandError -> ShowS
showsPrec :: Int -> CommandError -> ShowS
$cshow :: CommandError -> String
show :: CommandError -> String
$cshowList :: [CommandError] -> ShowS
showList :: [CommandError] -> ShowS
Show)

$(deriveTextShow ''CommandError)