From 4d85ce5584c5bc69b402b7d3b94c623f37ea69f5 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 27 Jan 2019 18:52:25 +0100 Subject: src: replace all undefined with typeMismatch --- src/Reaktor/Plugins/System/Internal.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Reaktor/Plugins/System/Internal.hs') diff --git a/src/Reaktor/Plugins/System/Internal.hs b/src/Reaktor/Plugins/System/Internal.hs index 78c8802..e4356df 100644 --- a/src/Reaktor/Plugins/System/Internal.hs +++ b/src/Reaktor/Plugins/System/Internal.hs @@ -4,6 +4,7 @@ module Reaktor.Plugins.System.Internal where import Prelude.Extended import Data.Aeson +import Data.Aeson.Types (typeMismatch) import Reaktor () import qualified Reaktor.IRC as IRC import Text.Regex.PCRE.Light (Regex) @@ -27,7 +28,7 @@ instance FromJSON Activate where String "always" -> pure Always String "match" -> pure Match String "query" -> pure Query - _ -> undefined + invalid -> typeMismatch "Activate" invalid data Config = Config { cWorkDir :: Maybe FilePath @@ -44,7 +45,7 @@ instance FromJSON Config where Config <$> v .:? "workdir" <*> v .:? "hooks" .!= mempty - _ -> undefined + invalid -> typeMismatch "Config" invalid data Hook = Hook { hActivate :: Activate @@ -68,7 +69,7 @@ instance FromJSON Hook where <*> v .:? "workdir" <*> v .:? "commands" .!= mempty <*> (fmap (*1000000) <$> v .:? "timeoutSec" .!= Just 10) - _ -> undefined + invalid -> typeMismatch "Hook" invalid data SystemCommand = SystemCommand @@ -85,5 +86,4 @@ instance FromJSON SystemCommand where <$> v .: "filename" <*> v .:? "workdir" <*> v .:? "env" - _ -> undefined - + invalid -> typeMismatch "SystemCommand" invalid -- cgit v1.2.3