

def write_tw_error(self, msg):
    'Write a JSON error-reporting command through the socket.\n        '
    try:
        obj = {
            'cmd': 'error',
            'text': msg,
        }
        self.write_message(obj)
    except Exception as ex:
        self.application.twlog.warning('Unable to send error to websocket (%s): %s', msg, ex)

dataset/ETHPy150Open erkyrath/tworld/lib/tweblib/handlers.py PlayWebSocketHandler.write_tw_error/original