Add server-side error message handler.

This commit is contained in:
Shiz 2014-02-22 11:59:56 +01:00
parent 0b05101696
commit 37c9f204c7
1 changed files with 10 additions and 1 deletions

View File

@ -5,11 +5,15 @@ import itertools
import copy
from pydle.async import Future
from pydle.client import BasicClient, NotInChannel, AlreadyInChannel
from pydle.client import BasicClient, NotInChannel, AlreadyInChannel, Error
from . import parsing
from . import protocol
class ServerSideError(Error):
pass
class RFC1459Support(BasicClient):
""" Basic RFC1459 client. """
DEFAULT_QUIT_MESSAGE = 'Quitting'
@ -402,6 +406,11 @@ class RFC1459Support(BasicClient):
## Callback handlers.
def on_raw_error(self, message):
""" Server encountered an error and will now close the connection. """
error = ServerSideError(' '.join(message.params))
self.on_data_error(error)
def on_raw_invite(self, message):
""" INVITE command. """
nick, metadata = self._parse_user(message.source)