-
-
reviewboard/webapi/resources/base_review.py (Diff revision 1) Can you define a new error type for this in reviewboard/webapi/errors.py ? You can probably use the same error code/definition for all of the publishing failures.
Add publishing signals
Review Request #5723 — Created April 21, 2014 and submitted
Information | |
---|---|
mcote | |
Review Board | |
master | |
0acef89... | |
Reviewers | |
reviewboard | |
This adds "publishing" signals, executed before any data is saved. The intention is that an extension can block publishing if, for example, there's a problem communicating with an outside system, by raising an exception.
I added a PublishError class and made web API publish functions turn them into WebAPIErrors. This is the part I'm least certain about. I want to allow extension to define the errors, but it doesn't make sense for the publishing signal handlers to be throwing WebAPIErrors directly. The compromise I came up with was to just put the PublishError string into a generic WebAPIError with a special user code of 999. Other ideas welcome; I just wanted something to start a conversation.
The ReviewRequestEditor model already had some basic error handling (a simple alert dialog). I added similar error handling to DraftReviewBannerView and ReviewReplyDraftBannerView. As far as I can tell, that covers all interfaces to updating (publishing) reviews, review requests, and review replies.
All tests pass except some VCS-specific ones, which were skipped. I also did some manual verification of the full system by throwing PublishError exceptions in an extension and verifying that the message appeared in an alert box in the UI.
Description | From | Last Updated |
---|---|---|
Can you define a new error type for this in reviewboard/webapi/errors.py ? You can probably use the same error code/definition … |
|
|
We've switched over to the new-style except PublishError as e |
|
|
except PublishError as e |
|
|
except PublishError as e |
|
|
Alignment isn't quite right here. |
|
Change Summary:
Use proper PUBLISH_ERROR.
Branch: |
|
||||
---|---|---|---|---|---|
Commit: |
|
||||
Diff: |
Revision 2 (+70 -8) |
-
-
reviewboard/webapi/resources/base_review.py (Diff revision 2) We've switched over to the new-style
except PublishError as e
-
-
Change Summary:
Fixed exception-handling style. I also noticed that there is no information in the "review_request" object at the time the publishing signal is sent. So I moved the fetching of the review_request_draft object up and changed the publishing signal to pass that instead.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+73 -9) |
-
One last nit.
-
Change Summary:
Fixed alignment.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+73 -9) |