import json


class ClientError(Exception):
    def __init__(self, code):
        super(ClientError, self).__init__(code)
        self.code = code

    def send_to(self, channel):
        channel.send({
            "text": json.dumps({
                "error": self.code,
            }),
        })

Add ClientError exception to handle sending back web socket errors to the client.
Add ClientError exception to handle sending back web socket errors to the client.
