Archived
1
0
Fork 0

Fixed the clean killing of plugin's threads, fixed exception management and cleaned plugins' main functions.

This commit is contained in:
Julien Dessaux 2010-02-08 00:11:46 +01:00
parent 416460886d
commit bfc06f1ff1
7 changed files with 27 additions and 33 deletions

View file

@ -2,7 +2,9 @@ module Hsbot.Main
( imain
) where
import Control.Exception
import Control.Monad.State
import Prelude hiding (catch)
import System.IO
import Config
@ -15,8 +17,8 @@ import Hsbot.Types
imain :: IO ()
imain = do
bot <- connectServer $ ircServer config
bot' <- (execStateT run bot) `catch` (const $ return bot)
evalStateT disconnectServer bot'
(execStateT run bot) `catch` (\(ex :: IOException) -> return bot)
evalStateT disconnectServer bot
-- | The Bot monad main function
run :: IrcBot ()