canonical / python-libmaas

Unofficial python client library for MAAS
https://maas.io
Other
62 stars 70 forks source link

Delete character number restriction on error messages #270

Open zLukas opened 2 years ago

zLukas commented 2 years ago

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.

samschmitt22 commented 1 year ago

I am also routinely annoyed by this.

github-actions[bot] commented 7 months ago

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