diff options
Diffstat (limited to 'src/Plugin/GitHubCommit.hs')
-rw-r--r-- | src/Plugin/GitHubCommit.hs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/Plugin/GitHubCommit.hs b/src/Plugin/GitHubCommit.hs index 8c11a12..73b617c 100644 --- a/src/Plugin/GitHubCommit.hs +++ b/src/Plugin/GitHubCommit.hs @@ -24,15 +24,12 @@ gitHubCommitAction message dbConn = do \ LIMIT 1" (Only (M.channel message)) :: IO [RepoUrlRow] - -- return $ response rs - respond rs + return $ respond rs where - respond [] = fail "I couldn't find a repo URL for this channel. \ - \ Try `git remote set origin REPO_URL`" + respond [] = Left "I couldn't find a repo URL for this channel. \ + \Try `git remote set origin REPO_URL`" respond ((RepoUrlRow r):rs) = - return r ++ "/commits/" ++ M.text message =~ matchRegex gitHubCommit --- TODO: Make an Either type for plugins to return errors --- if empty query result, return an empty error, otherwise return the string + Right $ r ++ "/commits/" ++ M.text message =~ matchRegex gitHubCommit type Id = Int |