python-libmaas icon indicating copy to clipboard operation
python-libmaas copied to clipboard

Delete character number restriction on error messages

Open zLukas opened this issue 3 years ago • 2 comments

In current version of python-lib maas dowlnoaded from github (commit ae3e321) Error messages can be no longer than 50 characters:

# amc/lib/python3.8/site-packages/maas/client/bones/__init__.py
class CallError(Exception):
    def __init__(self, request, response, content, call):
        desc_for_request = "%(method)s %(uri)s" % request
        desc_for_response = "HTTP %s %s" % (response.status, response.reason)
        desc_for_content = content.decode("utf-8", "replace")
        desc = "%s -> %s (%s)" % (
            desc_for_request,
            desc_for_response,
            desc_for_content
            if len(desc_for_content) <= 50
            else (desc_for_content)[:49] + "…"),
        )
        super(CallError, self).__init__(desc)
        self.request = request
        self.response = response
        self.content = content
        self.call = call

This lead to the situation where Error message actually tells nothing about error:

maas.client.bones.CallError: POST <http> -> HTTP 409 Conflict (Cannot set default gateway interface because the …)

I don't see a point of restricting such messages.

zLukas avatar Feb 08 '22 07:02 zLukas

I am also routinely annoyed by this.

samschmitt22 avatar Apr 04 '23 17:04 samschmitt22

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Feb 02 '24 01:02 github-actions[bot]