Closed Bug 418406 Opened 18 years ago Closed 17 years ago

Make network error constants accessible via Components.results

Categories

(Core :: XPConnect, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9beta5

People

(Reporter: jwkbugzilla, Assigned: jwkbugzilla)

References

Details

Attachments

(1 file, 1 obsolete file)

The error constants that are accessible via Components.results are defined in xpc.msg, this file currently lists the common errors (nsError.h, including file errors) and the XPC errors (nsIXPConnect.h). However, network errors (nsNetError.h) are not listed. This makes interpreting network errors from JavaScript unnecessarily hard - one has to hardcode constants and rely on them never changing. Also, exception messages contain only the nsresult code but no exception name.
Version: unspecified → Trunk
Attached patch Proposed patch (obsolete) — Splinter Review
The description strings are mostly copied from nsNetError.h - with exception of a few strings that had to be shortened down as well as FTP and cache errors that are currently undocumented.
Assignee: nobody → trev.moz
Status: NEW → ASSIGNED
Attachment #304233 - Flags: review?
Attachment #304233 - Flags: review? → review?(cbiesinger)
Attachment #304233 - Flags: superreview?(jonas)
With "unnecessarily hard", Waldimir means this: http://mxr.mozilla.org/seamonkey/source/extensions/sroaming/resources/content/transfer/utility.js#288 which I absolutely hated and costed me a lot of time, but it was the only way to translate network errors.
What's the story here with regards to late l10n changes?
This file isn't translated, error messages are always in English (and usually not visible to end users).
Comment on attachment 304233 [details] [diff] [review] Proposed patch Thanks for doing this! Just some comments on the strings: +XPC_MSG_DEF(NS_ERROR_CONNECTION_REFUSED , "The connection attempt failed") The message here really must say "The connection was refused", because "failed" is is too unspecific +XPC_MSG_DEF(NS_ERROR_PROXY_CONNECTION_REFUSED , "The connection attempt to a proxy failed") same here +XPC_MSG_DEF(NS_ERROR_NET_TIMEOUT , "The connection was lost due to a timeout error") Hmm, the rather more common occurrence for this error is when the connect() timed out. +XPC_MSG_DEF(NS_ERROR_NOT_RESUMABLE , "This request is not resumable, but it was tried to resume it") no, you can get the error without trying to resume. for example if you access the entityID of a nonresumable channel. +XPC_MSG_DEF(NS_ERROR_FTP_PWD , "FTP error while retriving current directory") retrieving (also in the next one) +XPC_MSG_DEF(NS_ERROR_UNKNOWN_HOST , "The lookup of a hostname failed") s/a/the/ ? +XPC_MSG_DEF(NS_ERROR_UNKNOWN_PROXY_HOST , "The lookup of a proxy hostname failed") here too +XPC_MSG_DEF(NS_ERROR_CACHE_ENTRY_DOOMED , "Cache entry still exists but is already doomed") why not just make this "Cache entry has been doomed". The cache entry doesn't really exist anymore when it has been doomed. +XPC_MSG_DEF(NS_ERROR_DOCUMENT_NOT_CACHED , "Document could not be fetched from the cache") Document does not exist in the cache.
Attachment #304233 - Flags: review?(cbiesinger) → review+
> "The connection was refused" This could be misunderstood by a user to mean that the password is wrong etc.. "Refused" smells a lot like policy/police. I'd say "The network connection was refused by the server" Or do we routinely get this when there's a firewall blocking outgoing connections? If so, drop "the server", but still add "network". > "Cache entry still exists but is already doomed" Please replace "doomed". My only association is a) the game "Doom" and b) voodoo, not even I know what this means in the context of cache. Is "expired" correct? "declared as outdated"?
(In reply to comment #5) > +XPC_MSG_DEF(NS_ERROR_NET_TIMEOUT , "The connection was lost > due to a timeout error") > > Hmm, the rather more common occurrence for this error is when the connect() > timed out. Looking at netError.dtd, this is error is called "The connection has timed out" - I think we can reuse that description. > +XPC_MSG_DEF(NS_ERROR_NOT_RESUMABLE , "This request is not > resumable, but it was tried to resume it") > > no, you can get the error without trying to resume. for example if you access > the entityID of a nonresumable channel. Ok, I added "or to request resume-specific data" that was in the original description of this error. (In reply to comment #6) Ben, these strings (and especially the ones concerning cache) are meant for developers and not for the user. TomTom HOME can "translate" them before showing them to the user, and it should be doing that.
Attached patch Patch v2Splinter Review
Attachment #304233 - Attachment is obsolete: true
Attachment #308262 - Flags: superreview?(jonas)
Attachment #308262 - Flags: review+
Attachment #304233 - Flags: superreview?(jonas)
(In reply to comment #6) > Please replace "doomed". My only association is a) the game "Doom" and b) > voodoo, not even I know what this means in the context of cache. > Is "expired" correct? "declared as outdated"? Especially the doomed message, but also the others, is unlikely to be seen by users. It's a technical term of our cache implementation... there's a doom() function, when you call it the entry is doomed. That basically deletes the entry.
Attachment #308262 - Flags: superreview?(jonas) → superreview+
Attachment #308262 - Flags: approval1.9?
Comment on attachment 308262 [details] [diff] [review] Patch v2 a1.9+=damons
Attachment #308262 - Flags: approval1.9? → approval1.9+
Keywords: checkin-needed
Checking in js/src/xpconnect/src/xpc.msg; /cvsroot/mozilla/js/src/xpconnect/src/xpc.msg,v <-- xpc.msg new revision: 1.27; previous revision: 1.26 done Checking in js/src/xpconnect/src/xpcexception.cpp; /cvsroot/mozilla/js/src/xpconnect/src/xpcexception.cpp,v <-- xpcexception.cpp new revision: 1.36; previous revision: 1.35 done
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9beta5
Blocks: 454360
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: