mirror of https://github.com/Shizmob/pydle.git
Add server-side error message handler.
This commit is contained in:
parent
0b05101696
commit
37c9f204c7
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue