Closed
Bug 286450
Opened 19 years ago
Closed 19 years ago
nsScriptError.message is not very helpful
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
mozilla1.8beta2
People
(Reporter: benjamin, Assigned: benjamin)
Details
Attachments
(1 file, 1 obsolete file)
12.73 KB,
patch
|
dbradley
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
nsScriptError implements nsIConsoleMessage.message as the plain error message without line# etc. Instead, nsIConsoleMessage.message should return the same thing as nsIScriptError.toString, and there should be a separate attribute on nsIScriptError to access the "bare" error message. Patch coming up. I need this for error logging to file in xulrunner/toolkit startup.
Assignee | ||
Comment 1•19 years ago
|
||
Attachment #177633 -
Flags: superreview?(bzbarsky)
Attachment #177633 -
Flags: review?(dbradley)
Comment 2•19 years ago
|
||
Don't forget to change the interface UUID!
Comment 3•19 years ago
|
||
Comment on attachment 177633 [details] [diff] [review] Add nsIScriptError.errorMessage you should check for OOM from ToNewUnicode before returning NS_OK; but why add a method that's redundant with toString?
Comment 4•19 years ago
|
||
Yeah, what biesi said.. having two methods/properties that do the same exact thing seems a little odd. Why not just use toString() in whatever code it is you have?
Assignee | ||
Comment 5•19 years ago
|
||
Because my logging code is XPCOM-only (it does not and cannot know about nsIScriptError). Basically, this makes the nsIConsoleMessage interface output a reasonably helpful error message even without knowing anything about nsIScriptError.
Comment 6•19 years ago
|
||
Comment on attachment 177633 [details] [diff] [review] Add nsIScriptError.errorMessage Ah, I see. >Index: js/src/xpconnect/idl/nsIScriptError.idl Like darin said, rev the uuid. >+ /** >+ * The error message without any context/line number information. >+ */ >+ readonly attribute wstring errorMessage; Probably worth more clearly documenting how this differs from the "message" attribute... Also, possibly worth making this an AString, not a wstring. >Index: js/src/xpconnect/src/nsScriptError.cpp >+ nsXPIDLCString message; >+ rv = ToString(getter_Copies(message)); So now "message" is in what encoding? Looking at ToString(), it's just taking the UTf-16 string and dropping the high bytes... >+ *result = ToNewUnicode(message); And then we byte-expand. So ISO-8859-1 will survive this procedure, but everything else is screwed. I'd sort of prefer something that didn't do that (perhaps use ToNewUTF8String in toString() and then UTFtoNewUnicode, or CopyUTF8ToUTF16 depending on what the attr ends up returning here?).
Attachment #177633 -
Flags: superreview?(bzbarsky) → superreview-
Assignee | ||
Comment 7•19 years ago
|
||
Attachment #177633 -
Attachment is obsolete: true
Attachment #177865 -
Flags: superreview?(bzbarsky)
Attachment #177865 -
Flags: review?(dbradley)
Comment 8•19 years ago
|
||
Comment on attachment 177865 [details] [diff] [review] Add nsIScriptError.errorMessage and use new string types Much happier! sr=bzbarsky.
Attachment #177865 -
Flags: superreview?(bzbarsky) → superreview+
Comment 9•19 years ago
|
||
Comment on attachment 177865 [details] [diff] [review] Add nsIScriptError.errorMessage and use new string types r=dbradley
Attachment #177865 -
Flags: review?(dbradley) → review+
Assignee | ||
Comment 10•19 years ago
|
||
Fixed on trunk.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.8beta2
Comment 11•19 years ago
|
||
js/src/xpconnect/src/xpcconvert.cpp + data->ToString(formattedMsg); rv = ConstructException(NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS, - formattedMsg, ifaceName, methodName, data, + formattedMsg.get(), ifaceName, methodName, data, Does this use the correct charset?
Comment 12•19 years ago
|
||
Comment on attachment 177633 [details] [diff] [review] Add nsIScriptError.errorMessage patch is obsolete, removing review request
Attachment #177633 -
Flags: review?(dbradley)
You need to log in
before you can comment on or make changes to this bug.
Description
•