Closed Bug 745197 Opened 8 years ago Closed 8 years ago

Add a hook in Bugzilla::Error::_throw_error() so that extensions can control the way to throw errors

Categories

(Bugzilla :: Extensions, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: LpSolit, Assigned: LpSolit)

References

Details

Attachments

(1 file, 1 obsolete file)

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.
Attached patch patch, v1 (obsolete) — Splinter Review
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.
Assignee: extensions → LpSolit
Status: NEW → ASSIGNED
Attachment #614855 - Flags: review?(timello)
Attachment #614855 - Flags: review?(dkl)
Attached patch patch, v1.1Splinter Review
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.
Attachment #614855 - Attachment is obsolete: true
Attachment #614855 - Flags: review?(timello)
Attachment #614855 - Flags: review?(dkl)
Attachment #614857 - Flags: review?(timello)
Attachment #614857 - Flags: review?(dkl)
Keywords: relnote
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
Attachment #614857 - Flags: review?(dkl) → review+
Attachment #614857 - Flags: review?(timello)
Great, thanks! :)
Flags: approval4.2+
Flags: approval+
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.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Added to relnotes for 4.2.1.
Keywords: relnote
Blocks: 818621
You need to log in before you can comment on or make changes to this bug.