view hglib/error.py @ 216:68588c652ac6

client: handle commit messages with \0 characters Mercurial allows commit messages containing \0 characters, but hglib does not properly handle them. By using the json template, these characters are correctly escaped. Note: initial change only modifies this for the 'log' command, I'll follow-up for other commands if this is ok.
author Mathias De Mare <mathias.de_mare@nokia.com>
date Wed, 08 Mar 2023 16:22:21 +0100
parents 59cb26bf866e
children
line wrap: on
line source

class CommandError(Exception):
    def __init__(self, args, ret, out, err):
        self.args = args
        self.ret = ret
        self.out = out
        self.err = err

    def __str__(self):
        return str((self.ret, self.out.rstrip(), self.err.rstrip()))

class ServerError(Exception):
    pass

class ResponseError(ServerError, ValueError):
    pass

class CapabilityError(ServerError):
    pass