verloop / twirpy

Twirp's python implementation
The Unlicense
99 stars 20 forks source link

Wrapping ConnectionErrors in python3 results in an AttributeError #33

Closed Ghnuberath closed 3 years ago

Ghnuberath commented 3 years ago

In TwirpClient's _make_request, ConnectionErrors are wrapped as TwirpServerExceptions:

raise exceptions.TwirpServerException(
    code=errors.Errors.Unavailable,
    message=e.message,
    meta={"original_exception": e},
)

Which, in python3, causes an AttributError because ConnectionError does not have message anymore.

I believe a simple fix would be to change this (and the Timeout error as well) to:

raise exceptions.TwirpServerException(
    code=errors.Errors.Unavailable,
    message=str(e),
    meta={"original_exception": e},
)