diff options
Diffstat (limited to 'src/Reaktor/Plugins')
-rw-r--r-- | src/Reaktor/Plugins/Register.hs | 5 | ||||
-rw-r--r-- | src/Reaktor/Plugins/System/Internal.hs | 10 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/Reaktor/Plugins/Register.hs b/src/Reaktor/Plugins/Register.hs index 979e4ba..dcd130e 100644 --- a/src/Reaktor/Plugins/Register.hs +++ b/src/Reaktor/Plugins/Register.hs @@ -6,6 +6,7 @@ module Reaktor.Plugins.Register where import Blessings import Data.Aeson +import Data.Aeson.Types (typeMismatch) import qualified Data.Text as T import qualified Data.Text.IO as T import Prelude.Extended @@ -23,7 +24,7 @@ instance FromJSON ConfigNickServ where ConfigNickServ <$> v .: "passFile" <*> v .:? "prefix" .!= "NickServ!NickServ@services." - _ -> undefined + invalid -> typeMismatch "ConfigNickServ" invalid data Config = Config { cNick :: Maybe Text @@ -43,7 +44,7 @@ instance FromJSON Config where cChannels <- v .:? "channels" .!= [] cNickServ <- v .:? "NickServ" .!= cNickServ def pure Config{..} - _ -> undefined + invalid -> typeMismatch "Config" invalid new :: Config -> Actions -> IO (Message -> IO ()) new Config{..} Actions{..} = do 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 |