Closed
Bug 1094858
Opened 10 years ago
Closed 10 years ago
Create hook in Bugzilla::WebService::Constants to allow overrriding of standard status codes by extensions
Categories
(Bugzilla :: Extensions, enhancement)
Bugzilla
Extensions
Tracking
()
RESOLVED
FIXED
Bugzilla 5.0
People
(Reporter: dkl, Assigned: dkl)
References
Details
Attachments
(1 file)
4.30 KB,
patch
|
gerv
:
review+
|
Details | Diff | Splinter Review |
Currently we have a constant called REST_STATUS_CODE_MAP that dictates which status codes are returned based on error codes in WS_ERROR_CODE. We need to make that a subroutine with a hook where extensions can choose different status codes to return base on type or error.
Assignee | ||
Comment 2•10 years ago
|
||
Attachment #8518308 -
Flags: review?(gerv)
Comment 3•10 years ago
|
||
Comment on attachment 8518308 [details] [diff] [review] 1094858_1.patch Review of attachment 8518308 [details] [diff] [review]: ----------------------------------------------------------------- r=gerv. Gerv ::: Bugzilla/Hook.pm @@ +1706,5 @@ > > +=head2 wevservice_status_code_map > + > +This hook allows for overriding the status codes returned by specific webservice > +error codes. The error codes that can be used are defined in the C<WS_ERROR_CODE> This first sentence isn't the clearest. How about: This hook allows an extension to change the status codes returned by specific webservice errors. The valid internal error codes that Bugzilla generates, and the status codes they map to by default, are defined in the C<WS_ERROR_CODE> constant in C<Bugzilla::WebService::Constants>. When remapping an error, you may wish to use an existing status code constant. Such constants are in XXXfile? and start with C<STATUS_*> such as C<STATUS_BAD_REQUEST>. ::: Bugzilla/WebService/Constants.pm @@ +239,4 @@ > # the related webvservice call. We choose the appropriate > # http status code based on the error code or use the > # default STATUS_BAD_REQUEST. > +sub REST_STATUS_CODE_MAP { I assume uses of REST_STATUS_CODE_MAP elsewhere don't have to change to be REST_STATUS_CODE_MAP() ? If not, that's fine.
Attachment #8518308 -
Flags: review?(gerv) → review+
Assignee | ||
Updated•10 years ago
|
Flags: approval?
Flags: approval5.0?
Target Milestone: --- → Bugzilla 5.0
Assignee | ||
Comment 4•10 years ago
|
||
(In reply to Gervase Markham [:gerv] from comment #3) > This first sentence isn't the clearest. How about: > > This hook allows an extension to change the status codes returned by > specific webservice errors. The valid internal error codes that Bugzilla > generates, and the status codes they map to by default, are defined in the > C<WS_ERROR_CODE> constant in C<Bugzilla::WebService::Constants>. When > remapping an error, you may wish to use an existing status code constant. > Such constants are in XXXfile? and start with C<STATUS_*> such as > C<STATUS_BAD_REQUEST>. Ok will change on commit to: This hook allows an extension to change the status codes returned by specific webservice errors. The valid internal error codes that Bugzilla generates, and the status codes they map to by default, are defined in the C<WS_ERROR_CODE> constant in C<Bugzilla::WebService::Constants>. When remapping an error, you may wish to use an existing status code constant. Such constants are also in C<Bugzilla::WebService::Constants> and start with C<STATUS_*> such as C<STATUS_BAD_REQUEST>. > REST_STATUS_CODE_MAP() > > ? If not, that's fine. We only use the constant in Bugzilla/Error.pm currently and it is already doing REST_STATUS_CODE_MAP(). dkl
Comment 5•10 years ago
|
||
Comment on attachment 8518308 [details] [diff] [review] 1094858_1.patch >+++ b/Bugzilla/Hook.pm >+=head2 wevservice_status_code_map s/wevservice/webservice/
Updated•10 years ago
|
Severity: normal → enhancement
Flags: approval?
Flags: approval5.0?
Flags: approval5.0+
Flags: approval+
Assignee | ||
Comment 6•10 years ago
|
||
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git 41dbccc..b9543e4 master -> master To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git 0d7b9c6..4e5a3b1 5.0 -> 5.0
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
*** ERROR: Apparent command =item not preceded by blank line at line 318 in file Bugzilla/WebService/Constants.pm not ok 130 - Bugzilla/WebService/Constants.pm has incorrect POD syntax --ERROR # Failed test 'Bugzilla/WebService/Constants.pm has incorrect POD syntax --ERROR' # at t/011pod.t line 79. To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git 4a43627..4b4ddaf 5.0 -> 5.0 To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git 8d368ae..ded5d29 master -> master
You need to log in
before you can comment on or make changes to this bug.
Description
•