Note: There are a few cases of duplicates in user autocompletion which are being worked on.

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

RESOLVED FIXED in Bugzilla 4.2

Status

()

Bugzilla
Extensions
--
enhancement
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Frédéric Buclin, Assigned: Frédéric Buclin)

Tracking

Bugzilla 4.2
Bug Flags:
approval +
approval4.2 +

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
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.
(Assignee)

Comment 1

5 years ago
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.
Assignee: extensions → LpSolit
Status: NEW → ASSIGNED
Attachment #614855 - Flags: review?(timello)
Attachment #614855 - Flags: review?(dkl)
(Assignee)

Comment 2

5 years ago
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.
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)
(Assignee)

Updated

5 years ago
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+
(Assignee)

Updated

5 years ago
Attachment #614857 - Flags: review?(timello)
(Assignee)

Comment 4

5 years ago
Great, thanks! :)
Flags: approval4.2+
Flags: approval+
(Assignee)

Comment 5

5 years ago
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
Last Resolved: 5 years ago
Resolution: --- → FIXED
(Assignee)

Comment 6

5 years ago
Added to relnotes for 4.2.1.
Keywords: relnote

Updated

5 years ago
Blocks: 818621
You need to log in before you can comment on or make changes to this bug.