Closed Bug 44050 Opened 25 years ago Closed 24 years ago

need error architecture (names and messages)

Categories

(Core :: XPCOM, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 13423
mozilla1.0

People

(Reporter: warrensomebody, Assigned: mike+mozilla)

References

Details

(Keywords: arch)

We need an architecture in xpcom to allow error constant names and error message strings to be supplied. Error constant names are necessary for js, so that you can say catch (e) { if (e == FILE_NOT_FOUND) ... } } instead of: catch (e) { if (e == 0x80045032) ... } } Error message strings (or string bundles) need to be coughed up so that once an error is returned by a component, the caller can go back to that component to ask for a message to format to the user. (This part is probably related to having nsINotification, bug 40729.) We may also want a way for a component to be able to say "I return errors in this range" so that we can map from error numbers back to the components that defined them.
Forgot to mention that there should be an interface that accesses this error info (nsIErrorInfo), and we should probably obtain that interface by asking the component's factory to construct a well-known CID, or by QI'ing the factory to nsIErrorInfo.
Keywords: arch
Status: NEW → ASSIGNED
Target Milestone: --- → M20
OS: Windows NT → All
I added nsIErrorService to xpcom -- until mccabe fixes bug 13423. We'll still need some sort of interface to access these error names from c++ though, once that comes along.
Depends on: 13423
Assigning rest of xpcom stuff to myself (from Ray).
Assignee: rayw → warren
Status: ASSIGNED → NEW
Target Milestone: M20 → mozilla1.0
So when I added code to necko to use the nsIErrorService (http://lxr.mozilla.org/seamonkey/source/netwerk/base/src/nsIOService.cpp#74), I chose error key names like "ResolvingHost" and "ConnectedTo" (see netwerk/resources/locale/en-US/necko.properties). However, I should have chosen name like "nsIFileTransportService.NS_NET_STATUS_READ_FROM" and "nsISocketTransportService.NS_NET_STATUS_CONNECTED_TO" -- the names that will finally be used when McCabe implements the error stuff for xpidl. This means that when his changes come along, the keys in necko.properties will have to be changed (as well as ripping out the work-around that explicitly registers the keys in nsIOService.cpp). Reassigning to mccabe.
Assignee: warren → mccabe
*** This bug has been marked as a duplicate of 13423 ***
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
You can do this now . . . It is all part of the Components.Exception object. catch (e) { if (e.name == "FILE_NOT_FOUND") ... } }
You need to log in before you can comment on or make changes to this bug.