Properly decode API errors from UTF-8
Review Request #10697 — Created Sept. 6, 2019 and submitted — Latest diff uploaded
When we received an error message from the Review Board API, if we
didn't have a pre-generated string for that error code locally we would
include the error body verbatim. We did this by attempting to cast it to
a string and encode it to utf-8, but that only works on Python 2 where
str is actually bytes. On Python 3, an error is raised becuase you are
not allowed to decode a bytes object into text without a codec.
Instead, we now return text from the API errors when calling
them, instead of returning their body verbatim.
While I was here, I also removed a bunch of unnecessary unicode
literals. We are using
unicode_literalseverywhere so they were
Confirmed the on Python versions 2.7, 3.5, 3.6, and 3.7:
- With this entire patch stack (/r/10685, /r/10695, and /r/10696),
rbt postis able to create review requests with commit history.