module Highlight.Common.Error where
import Prelude ()
import Prelude.Compat
import Highlight.Common.Options (RawRegex(RawRegex))
import Highlight.Util (die)
data HighlightErr
= HighlightRegexCompileErr RawRegex
deriving Int -> HighlightErr -> ShowS
[HighlightErr] -> ShowS
HighlightErr -> String
(Int -> HighlightErr -> ShowS)
-> (HighlightErr -> String)
-> ([HighlightErr] -> ShowS)
-> Show HighlightErr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HighlightErr] -> ShowS
$cshowList :: [HighlightErr] -> ShowS
show :: HighlightErr -> String
$cshow :: HighlightErr -> String
showsPrec :: Int -> HighlightErr -> ShowS
$cshowsPrec :: Int -> HighlightErr -> ShowS
Show
handleErr :: HighlightErr -> IO a
handleErr :: HighlightErr -> IO a
handleErr (HighlightRegexCompileErr (RawRegex String
regex)) =
Int -> String -> IO a
forall a. Int -> String -> IO a
die Int
10 (String -> IO a) -> String -> IO a
forall a b. (a -> b) -> a -> b
$ String
"Regex not well formed: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
regex