<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Making Sense of HRESULTS</title><link>http://blogs.msdn.com/b/ericlippert/archive/2003/10/22/53267.aspx</link><description>Every now and then -- like, say, this morning -- someone sends me this mail: "I'm getting an error in my JScript program. The error number is -2147024877. No description. Help!" Making sense of those error numbers requires some delving into the depths</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Making Sense of HRESULTS</title><link>http://blogs.msdn.com/b/ericlippert/archive/2003/10/22/53267.aspx#10033995</link><pubDate>Fri, 02 Jul 2010 17:20:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10033995</guid><dc:creator>Jay Hugard</dc:creator><description>&lt;p&gt;Thanks for responding, Eric!&lt;/p&gt;
&lt;p&gt;Worked this out after tracing into the assembly for the JScript engine. &amp;nbsp;See the following Question &amp;amp; Answer on StackOverflow.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://stackoverflow.com/questions/3145992/esoteric-jscript-hosting-problem-where-is-the-error-code-when-idispatchinvoke/3167705#3167705"&gt;stackoverflow.com/.../3167705&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Man, was that a tough mystery to unravel ;-) &amp;nbsp;Seriously underdocumented!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10033995" width="1" height="1"&gt;</description></item><item><title>re: Making Sense of HRESULTS</title><link>http://blogs.msdn.com/b/ericlippert/archive/2003/10/22/53267.aspx#10032445</link><pubDate>Wed, 30 Jun 2010 01:25:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10032445</guid><dc:creator>Jay Hugard</dc:creator><description>&lt;p&gt;I have a scriptable COM component (implements IDispatchEx) which has a method that takes a script-function as a parameter (an IDispatch* as a parameter). &amp;nbsp;My COM component calls back into script via that supplied IDispatch parameter.&lt;/p&gt;
&lt;p&gt;If the script-function happens to throw an exception, then my call to Invoke will return SCRIPT_E_PROPAGATE. &amp;nbsp;If I return that HRESULT back to the caller of my COM component, then the script engine throws an error.&lt;/p&gt;
&lt;p&gt;However, the *ACTUAL ERROR* is nowhere to be found. &amp;nbsp;It&amp;#39;s not returned in the Invoke HRESULT (that&amp;#39;s SCRIPT_E_PROPAGATE). &amp;nbsp;It&amp;#39;s not returned via the EXCEPINFO supplied to Invoke (the structure remains empty). &amp;nbsp;AND, it&amp;#39;s not available via GetErrorInfo (the call returns S_FALSE)!&lt;/p&gt;
&lt;p&gt;I&amp;#39;d *really* like to get my hands on that error, because it would be useful to cache it and return the same error on subsequent calls (getting to the error often involves an expensive operation that is defined by the script-function passed as a parameter, but I do know how to cache the error). &amp;nbsp;Is there a way for a scripted COM component to get to an exception thrown during a call-back into a supplied script-function???&lt;/p&gt;
&lt;div class="yellowbox"&gt;
&lt;p&gt;Hmm. I have not looked at that code for ten years (and I didn&amp;#39;t understand it real well then; I didn&amp;#39;t write the exception handling logic), so I&amp;#39;m a bit rusty. The EXCEPINFO ought to be filled in with the details. Do you know what exactly is being thrown by the script? Do you know if there are any possible handlers up the stack?&amp;nbsp;The engine should interrogate the IDispatchEx to see if it can determine a call stack that has a catch block. Is there any such call stack? &lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10032445" width="1" height="1"&gt;</description></item><item><title>re: Making Sense of HRESULTS</title><link>http://blogs.msdn.com/b/ericlippert/archive/2003/10/22/53267.aspx#5072485</link><pubDate>Sun, 23 Sep 2007 15:23:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5072485</guid><dc:creator>Jerome</dc:creator><description>&lt;p&gt;Excellent, thx.&lt;/p&gt;
&lt;p&gt;Thx to Jay Hugard too for his code&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5072485" width="1" height="1"&gt;</description></item><item><title>Human sacrifice, dogs and cats living together, mass hysteria! and thread model errors!</title><link>http://blogs.msdn.com/b/ericlippert/archive/2003/10/22/53267.aspx#2482624</link><pubDate>Tue, 08 May 2007 19:30:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2482624</guid><dc:creator>Fabulous Adventures In Coding</dc:creator><description>&lt;p&gt;Reader Shaka comments on my post about error messages that &amp;quot;catastrophic failure&amp;quot; really does take the&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2482624" width="1" height="1"&gt;</description></item><item><title>re: Making Sense of HRESULTS</title><link>http://blogs.msdn.com/b/ericlippert/archive/2003/10/22/53267.aspx#775442</link><pubDate>Thu, 28 Sep 2006 16:55:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:775442</guid><dc:creator>Alexey</dc:creator><description>What means error code 0x800a180e from Word::_Document interface?&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=775442" width="1" height="1"&gt;</description></item><item><title>
			Pelargir - Musings on software and life from Matthew Bass.			 &amp;raquo; Decoding COM HRESULT error codes		</title><link>http://blogs.msdn.com/b/ericlippert/archive/2003/10/22/53267.aspx#736645</link><pubDate>Sat, 02 Sep 2006 16:25:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:736645</guid><dc:creator>
			Pelargir - Musings on software and life from Matthew Bass.			 » Decoding COM HRESULT error codes		</dc:creator><description>PingBack from &lt;a rel="nofollow" target="_new" href="http://www.matthewbass.com/blog/2005/11/15/decoding-com-hresult-error-codes/"&gt;http://www.matthewbass.com/blog/2005/11/15/decoding-com-hresult-error-codes/&lt;/a&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=736645" width="1" height="1"&gt;</description></item><item><title>Integer Arithmetic in VBScript, Part Two</title><link>http://blogs.msdn.com/b/ericlippert/archive/2003/10/22/53267.aspx#275440</link><pubDate>Mon, 06 Dec 2004 06:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275440</guid><dc:creator>Fabulous Adventures In Coding</dc:creator><description>&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=275440" width="1" height="1"&gt;</description></item><item><title>Excellent Debugging info in Visual Studio</title><link>http://blogs.msdn.com/b/ericlippert/archive/2003/10/22/53267.aspx#260347</link><pubDate>Thu, 18 Nov 2004 10:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:260347</guid><dc:creator>Sohail Kadiwala</dc:creator><description>&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=260347" width="1" height="1"&gt;</description></item><item><title>re: Typing Hard Can Trip You Up</title><link>http://blogs.msdn.com/b/ericlippert/archive/2003/10/22/53267.aspx#206927</link><pubDate>Tue, 03 Aug 2004 17:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:206927</guid><dc:creator>Fabulous Adventures In Coding</dc:creator><description>&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=206927" width="1" height="1"&gt;</description></item><item><title>RE: Making Sense of HRESULTS</title><link>http://blogs.msdn.com/b/ericlippert/archive/2003/10/22/53267.aspx#53277</link><pubDate>Sat, 25 Oct 2003 01:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:53277</guid><dc:creator>Jay Hugard</dc:creator><description>Nuts... hit add before I could finish or proof the above...

As I was saying, can be used as follows:

function println(v) { WScript.echo(v) }

try
{
}
catch( e )
{
  if( e.number.toHRESULT() != 0x80070013 )
  {
    println( e.toString() );
  }
}
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=53277" width="1" height="1"&gt;</description></item></channel></rss>