How to deconstruct error return values?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

How to deconstruct error return values?

Jonathan Kamens-4
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.
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: How to deconstruct error return values?

Jonathan Protzenko
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

On Mon 02 Jul 2012 06:55:25 PM CEST, Jonathan Kamens wrote:

> 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.
> _______________________________________________
> dev-apps-thunderbird mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-apps-thunderbird
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: How to deconstruct error return values?

Jonathan Kamens-4
In reply to this post by Jonathan Kamens-4
Jonathan Protzenko <[hidden email]> 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.
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: How to deconstruct error return values?

Mark Banner-4
In reply to this post by Jonathan Kamens-4
On 02/07/2012 17:55, Jonathan Kamens wrote:
> 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.

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.
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: How to deconstruct error return values?

Mark Banner-4
In reply to this post by Jonathan Kamens-4
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.
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: How to deconstruct error return values?

Jonathan Kamens-4
In reply to this post by Mark Banner-4
Mark Banner <[hidden email]> 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
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: How to deconstruct error return values?

alta88[nntp]


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.


---On 2012.Jul.02 2:24 PM, Jonathan Kamens wrote:

> Mark Banner <[hidden email]> 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
>

_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: How to deconstruct error return values?

Axel Grude-3
In reply to this post by Jonathan Kamens-4
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 <[hidden email]>
To:
On 02/07/12 21:24, Jonathan Kamens wrote:

> Mark Banner <[hidden email]> 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
>


_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: How to deconstruct error return values?

Jonathan Kamens-4
In reply to this post by alta88[nntp]
"alta88[nntp]" <[hidden email]> 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
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird