Closed Bug 372537 Opened 18 years ago Closed 15 years ago

Improve CodeErrors: show the traceback (without function arguments)

Categories

(Bugzilla :: Bugzilla-General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.0

People

(Reporter: mkanat, Assigned: mkanat)

Details

Attachments

(1 file, 1 obsolete file)

Right now if Bugzilla::Object throws a CodeError, you have *no idea* where the actual problem is, since it doesn't tell you who the caller is. During a customization, I fixed this so that certain errors would give you more information about where you came from, and we should have that code upstream.
Attached patch v1 (obsolete) — Splinter Review
Okay, I just pulled this straight out of the NASA patch--I don't even know if it applies, but I think it should... :-)
Assignee: general → mkanat
Status: NEW → ASSIGNED
Attachment #257182 - Flags: review?(LpSolit)
Okay, I verified that it applies and compiles.
Comment on attachment 257182 [details] [diff] [review] v1 >=== modified file 'Bugzilla/Util.pm' > sub css_class_quote { > my ($toencode) = (@_); >- $toencode =~ s/ /_/g; >+ $toencode =~ s/[ :\/]/_/g; I don't see why this change is required for this fix. string_caller() has no POD. >=== modified file 'Bugzilla/Object.pm' > detaint_natural($id) > || ThrowCodeError('param_must_be_numeric', >+ {function => $class . '::_init', >+ caller => caller_string(2) }); caller_string(2) won't return anything if you call |new Bugzilla::Foo()| from a CGI script and new() is not defined in the .pm module, such as |new Bugzilla::Product| called from editproducts.cgi. IMO, you should display both caller_string(1) and caller_string(2), so that you get the complete path (caller_string(0) is useless as you would get Object->new in all cases). Except the problem above, your patch works fine.
Attachment #257182 - Flags: review?(LpSolit) → review-
Target Milestone: Bugzilla 3.2 → Bugzilla 4.0
Attached patch v2Splinter Review
Okay, so I had a better idea. For all CodeErrors, show the full traceback. I leave out method arguments from the traceback, so it should always be pretty safe. Also, thanks to the way that code-error.html.tmpl already works, this only affects ERROR_MODE_WEBPAGE, so WebService clients won't suddenly start getting Bugzilla tracebacks, which is good.
Attachment #257182 - Attachment is obsolete: true
Attachment #444359 - Flags: review?(LpSolit)
Target Milestone: Bugzilla 4.0 → Bugzilla 3.8
Attachment #444359 - Flags: review?(LpSolit) → review+
Comment on attachment 444359 [details] [diff] [review] v2 Yeah, nice to have some more debug info. r=LpSolit Note that this will not only affect Bugzilla::Object, but all calls to ThrowCodeError.
Flags: approval+
Summary: Improve Bugzilla::Object CodeErrors: Show the Caller → Improve CodeErrors: show the traceback (without function arguments)
Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/Error.pm modified template/en/default/global/code-error.html.tmpl Committed revision 7168.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Keywords: relnote
Added to the release notes in bug 604256.
Keywords: relnote
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: