toot icon indicating copy to clipboard operation
toot copied to clipboard

Cannot “toot post --using” since v0.30.0: Unknown error

Open kseistrup opened this issue 1 year ago • 1 comments

TL;DR: I cannot toot post --using in v0.30.0+: Unknown error

I have several accounts on the same Pleroma server. When I toot post with the activated account it works as before: as expected.

When I toot post --using with a non-activated account, all I see is the error message Unknown error. I believe I have located the message to the _get_error_message() method in http.py, but even if I print out the Exception I still only see this unhelpful error message.

However, when I add a return str(data), this is what I see:

{
  "errors": {
    "detail": "Internal server error"
  }
}

Since toot post --using has been working up until (and including) v0.29.0, I assume something has been changed in the way that toot is posting. I'm unsure how to proceeed, though.

  • OS name and version: ArchLinux rolling
  • Python version: 3.10.8
  • toot version: v0.30.0 and v0.30.1
  • Pleroma version: 2.4.3

Modified method in http.py:

def _get_error_message(response):
    """Attempt to extract an error message from response body"""
    try:
        data = response.json()
        if "error_description" in data:
            return data['error_description']
        if "error" in data:
            return data['error']
	return str(data)    # added because no exception is raised
    except Exception as error:
        return str(error)   # let's see what error we have instead of just pass'ing

    return "Unknown error"  # not reached

kseistrup avatar Dec 01 '22 15:12 kseistrup