From ccf11b5467b2f41690390a20bc50a02c006be3f0 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 10 Aug 2017 23:54:57 +0200 Subject: gitHubCommitAction: Get error handling to work using `Either` Get rid of the `fail` and use an `Either` for error handling instead. This allows us to send back the response string like before, but provide an additional error message when no data comes back from the database query. Remove the old error handling code I had tried to set up previously. --- src/Plugin/Base.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Plugin/Base.hs') diff --git a/src/Plugin/Base.hs b/src/Plugin/Base.hs index b752fd1..fe3a0f8 100644 --- a/src/Plugin/Base.hs +++ b/src/Plugin/Base.hs @@ -9,7 +9,7 @@ import Database.SQLite.Simple import Message -- TODO: Replace Connection with a type class -type PluginAction = Message -> Connection -> IO String +type PluginAction = Message -> Connection -> IO (Either String String) data Plugin = Plugin { matchRegex :: String -- cgit v1.2.3