Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to deconstruct error return values?

10 views
Skip to first unread message

Jonathan Kamens

unread,
Jul 2, 2012, 12:55:25 PM7/2/12
to
Can somebody fill me in on how to deconstruct the error codes
returned by Mozilla code?

nsIMsgFolder.messages is throwing an error with code
0x80550005 being caught in my JavaScript add-on code, and I
need to figure out how to interpret that code.

Thanks.

Jonathan Protzenko

unread,
Jul 2, 2012, 1:29:29 PM7/2/12
to Jonathan Kamens, dev-apps-t...@lists.mozilla.org
Here's some references:

https://developer.mozilla.org/en/Table_Of_Errors
https://developer.mozilla.org/en/Components.results

thunderbird-stdlib also defines NS_FAILED and NS_SUCCESS
<http://protz.github.com/thunderbird-stdlib/doc/symbols/_global_.html>
although I can't seem to find the native way of doing that -- which I
incidentally discovered later, possibly something like
Components.result.isSuccess or something.

I think there's no silver bullet here and you'll have to write some
custom code. I don't think we expose the mailnews-specific error codes
to the javascript side of things I'm afraid.

Good luck,

jonathan
> _______________________________________________
> dev-apps-thunderbird mailing list
> dev-apps-t...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-apps-thunderbird

Mark Banner

unread,
Jul 2, 2012, 1:52:14 PM7/2/12
to
http://james-ross.co.uk/mozilla/misc/nserror?0x80550005

will give you the vague details of the error code as it is in mailnews,
though if its a core error code it will give you more info.

In this case, the number of the error code is 5, and if you look in
msgCore.h, you'll find it is NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE

http://hg.mozilla.org/comm-central/file/5d6f4430479b/mailnews/base/public/msgCore.h#l103

You can, of course, reverse engineer this from the NS_ERROR_GENERATE*
macros in nsError.h:

http://mxr.mozilla.org/comm-central/source/mozilla/xpcom/base/nsError.h

Mark.

Mark Banner

unread,
Jul 2, 2012, 1:53:22 PM7/2/12
to
On 02/07/2012 18:29, Jonathan Protzenko wrote:
> I think there's no silver bullet here and you'll have to write some
> custom code. I don't think we expose the mailnews-specific error codes
> to the javascript side of things I'm afraid.

There's a core bug around somewhere on being able to extend the list of
error codes exposed to js. Only most of the core ones are defined in js atm.

Mark.

Jonathan Kamens

unread,
Jul 2, 2012, 1:51:11 PM7/2/12
to
Jonathan Protzenko <jonathan....@gmail.com> writes:
>I think there's no silver bullet here and you'll have to write some
>custom code. I don't think we expose the mailnews-specific error codes
>to the javascript side of things I'm afraid.

I have no idea what that custom code would look like.

My goal is not to generically interpret all possible return
codes, but rather to figure out what this particular return
code means. It doesn't seem like I should need to write code
to do that.

The code itself doesn't appear in any header file as exactly
the string "80550005", so I assume error codes are
constructed using some sort of macro and they actually
consist of multiple parts. If somebody could tell me what the
parts are, I could search for the individual parts in the
header files and find the relevant error code that way.

Jonathan Kamens

unread,
Jul 2, 2012, 4:24:25 PM7/2/12
to
Mark Banner <mba...@mozilla.com> writes:
>In this case, the number of the error code is 5, and if you look in
>msgCore.h, you'll find it is NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE

Thanks.

That was less useful than I'd hoped :-/, because the same
error code is returned in multiple locations. I hate that.

Here's the situation... My add-on is calling getMessages on a
nsIMsgFolder object, and occasionally it's getting back that
error code.

Is there anything I can do when that happens to get
Thunderbird to update the summary? Would calling
summaryChanged() do it? How about updateFolder()? These
methods are not documented at
https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIMsgFolder
(or anywhere else that I could find).

The users who report running into this issue report running
into it _repeatedly_, i.e., once it starts happening, it keeps
happening until they open the properties dialog for the folder
and click the "Repair Folder" button. Do I actually need to
programmatically reproduce what "Repair Folder" does? That
seems gross, since "Repair Folder" resets the visible
columns, layout, etc. for the folder, which I'd really rather
not do to a user's folder without permission. Maybe it's
possible to do the summary repair part of "Repair Folder"
without the other stuff?

Ugh.

Thanks,

jik

alta88[nntp]

unread,
Jul 2, 2012, 6:28:59 PM7/2/12
to


this is likely due to the msgDatabase (.msf index file) being
unavailable, as a result of a valid (or not) stale condition. user
selection of a folder would force a reparse, but in cases of batch
processing (like with feeds) it was necessary to finally put in an auto
reparse.

take a look at newsblog.js in the feeder function.

Axel Grude

unread,
Jul 10, 2012, 9:26:44 AM7/10/12
to
what triggers your code? chances are your listening for the wrong event.

--------------Original Message--------------
Subject: Re: How to deconstruct error return values?
Date: Mon, 2 Jul 2012 20:24:25 +0000 (UTC)
From: Jonathan Kamens <j...@kamens.us>
To:

Jonathan Kamens

unread,
Jul 12, 2012, 3:52:06 PM7/12/12
to
"alta88[nntp]" <alt...@gmail.com> writes:
>this is likely due to the msgDatabase (.msf index file) being
>unavailable, as a result of a valid (or not) stale condition. user
>selection of a folder would force a reparse, but in cases of batch
>processing (like with feeds) it was necessary to finally put in an auto
>reparse.
>
>take a look at newsblog.js in the feeder function.

Perfect! That did the trick. Thanks.

jik
0 new messages