Last Comment Bug 745197 - Add a hook in Bugzilla::Error::_throw_error() so that extensions can control the way to throw errors
: Add a hook in Bugzilla::Error::_throw_error() so that extensions can control ...
Status: RESOLVED FIXED
:
Product: Bugzilla
Classification: Server Software
Component: Extensions (show other bugs)
: 4.2
: All All
: -- enhancement (vote)
: Bugzilla 4.2
Assigned To: Frédéric Buclin
: default-qa
:
Mentors:
Depends on:
Blocks: 818621
  Show dependency treegraph
 
Reported: 2012-04-13 08:02 PDT by Frédéric Buclin
Modified: 2012-12-05 11:33 PST (History)
2 users (show)
LpSolit: approval+
LpSolit: approval4.2+
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
patch, v1 (7.14 KB, patch)
2012-04-13 10:54 PDT, Frédéric Buclin
no flags Details | Diff | Splinter Review
patch, v1.1 (7.62 KB, patch)
2012-04-13 10:59 PDT, Frédéric Buclin
dkl: review+
Details | Diff | Splinter Review

Description Frédéric Buclin 2012-04-13 08:02:39 PDT
Testopia uses JSON heavily to refresh its pages (rather than reloading the whole HTML pages again and again) and when something goes wrong, it must format errors to be understood by the JSON client. Extensions can define their own ERROR_MODE_* codes and pass them to Bugzilla->error_mode(), but they have no way to take advantage of this as Bugzilla::Error::_throw_error() has no hook to handle custom error codes. So we need one.
Comment 1 Frédéric Buclin 2012-04-13 10:54:57 PDT
Created attachment 614855 [details] [diff] [review]
patch, v1

Ideally, I would like to take it for 4.2.1, as it's needed by Testopia to work without having to hack the source code of Bugzilla.
Comment 2 Frédéric Buclin 2012-04-13 10:59:58 PDT
Created attachment 614857 [details] [diff] [review]
patch, v1.1

Oops, I forgot to include code-error.html.tmpl in the patch. I added the same ID as in user-error.html.tmpl, which already defines it.
Comment 3 David Lawrence [:dkl] 2012-04-17 11:49:07 PDT
Comment on attachment 614857 [details] [diff] [review]
patch, v1.1

Review of attachment 614857 [details] [diff] [review]:
-----------------------------------------------------------------

No issues that I can see and the hook works as expected in my testing. r=dkl
Comment 4 Frédéric Buclin 2012-04-17 11:55:30 PDT
Great, thanks! :)
Comment 5 Frédéric Buclin 2012-04-17 12:12:02 PDT
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/Error.pm
modified Bugzilla/Hook.pm
modified extensions/Example/Extension.pm
modified template/en/default/global/code-error.html.tmpl
Committed revision 8201.


Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.2/
modified Bugzilla/Error.pm
modified Bugzilla/Hook.pm
modified extensions/Example/Extension.pm
modified template/en/default/global/code-error.html.tmpl
Committed revision 8077.
Comment 6 Frédéric Buclin 2012-04-17 12:27:31 PDT
Added to relnotes for 4.2.1.

Note You need to log in before you can comment on or make changes to this bug.