aboutsummaryrefslogtreecommitdiffstats
path: root/src/Reaktor/Plugins/System/Internal.hs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-01-27 18:52:25 +0100
committertv <tv@krebsco.de>2019-01-27 18:52:25 +0100
commit4d85ce5584c5bc69b402b7d3b94c623f37ea69f5 (patch)
treeeb1b5b01b521b7d8c695384f3e731413a0f5689a /src/Reaktor/Plugins/System/Internal.hs
parent32ddebc0309a73c50e0f1974b4f9435fce3f86c9 (diff)
src: replace all undefined with typeMismatch
Diffstat (limited to 'src/Reaktor/Plugins/System/Internal.hs')
-rw-r--r--src/Reaktor/Plugins/System/Internal.hs10
1 files changed, 5 insertions, 5 deletions
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