Fix WebAPI errors returning empty messages
Review Request #7415 — Created June 12, 2015 and submitted
Previously, the WebAPI would sometimes return a empty error. This was
because we were referring to themsg
attribute of the underlying
exception, instead of casting it to a text type.Also fix some typos that were introduced in the errors module.
Unit tests have been introduced to test the behaviour of raising a
ReopenError
,CloseError
, andPublishingError
during a review
request reopen, close, and publish, respectively.
Ran unit tests.
- Description:
-
Previously, the WebAPI would sometimes return a empty error. This was
because we were referring to the msg
attribute of the underlyingexception, instead of casting it to a text type. + + Also fix some typos that were introduced in the errors module.
- Testing Done:
-
+ Created an extension that raised
PublishError
andReopenError
.+ Verified they were caught and returned the appropriate API errors. - Commit:
-
3dd552df7c7e461a51ef88446fbea5286f73097679d58297e05d54ccb265096c3bd20aae5485244d
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/review_request_draft.py reviewboard/webapi/resources/base_review.py reviewboard/webapi/resources/review_reply.py reviewboard/reviews/errors.py reviewboard/webapi/resources/review_request.py Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/review_request_draft.py reviewboard/webapi/resources/base_review.py reviewboard/webapi/resources/review_reply.py reviewboard/reviews/errors.py reviewboard/webapi/resources/review_request.py
-
Guess we don't have unit tests around this. Can you add some? I want to be sure this can never happen again.
- Change Summary:
-
Unit tests
- Description:
-
Previously, the WebAPI would sometimes return a empty error. This was
because we were referring to the msg
attribute of the underlyingexception, instead of casting it to a text type. Also fix some typos that were introduced in the errors module.
+ + Unit tests have been introduced to test the behaviour of raising a
+ ReopenError
,CloseError
, andPublishingError
during a review+ request reopen, close, and publish, respectively. - Testing Done:
-
~ Created an extension that raised
PublishError
andReopenError
.~ Ran unit tests.
- Verified they were caught and returned the appropriate API errors. - Commit:
-
79d58297e05d54ccb265096c3bd20aae5485244df12dd01123fc825b32ecfd0d45a65944230a3260
- Diff:
-
Revision 3 (+107 -10)
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/review_request_draft.py reviewboard/webapi/tests/test_review_request.py reviewboard/webapi/resources/review_request.py reviewboard/webapi/resources/base_review.py reviewboard/reviews/errors.py reviewboard/webapi/resources/review_reply.py Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/review_request_draft.py reviewboard/webapi/tests/test_review_request.py reviewboard/webapi/resources/review_request.py reviewboard/webapi/resources/base_review.py reviewboard/reviews/errors.py reviewboard/webapi/resources/review_reply.py
-
-
-
-
- Change Summary:
-
PEP8
- Commit:
-
f12dd01123fc825b32ecfd0d45a65944230a3260d2948c9b6dbc5eb68c20832b586491d0ad4d90d7
- Diff:
-
Revision 4 (+108 -10)
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/review_request_draft.py reviewboard/webapi/tests/test_review_request.py reviewboard/webapi/resources/review_request.py reviewboard/webapi/resources/base_review.py reviewboard/reviews/errors.py reviewboard/webapi/resources/review_reply.py Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/review_request_draft.py reviewboard/webapi/tests/test_review_request.py reviewboard/webapi/resources/review_request.py reviewboard/webapi/resources/base_review.py reviewboard/reviews/errors.py reviewboard/webapi/resources/review_reply.py