locked
0x80000004 - JavaScript runtime error: No such interface supported RRS feed

  • Question

  • In my C++ runtime component, it throws an exception with customzied hresult and a string.

        if (ER_OK != status) {
            throw Platform::Exception::CreateException(0x80000000 | (int)(status), "My Error message"));
        }

    For the javascript app that uses the c++ runtime component, the exception is shown as "0x80000004 - JavaScript runtime error: No such interface supported". This is very misleading to developers.

    =========================The Visual Studio Debugger Output=================================

    Unhandled exception at line 291, column 13 in ms-appx://a9486bc2-5b1b-4c01-ba95-c7bf7ac2739a/js/alljoyn.js

    0x80000004 - JavaScript runtime error: No such interface supported

    WinRT information: No such interface supported

    Wednesday, December 26, 2012 8:08 PM

Answers

  • Hi Renjie,

    You cannot trap custom exceptions in JavaScript.  Instead provide a mechanism to get a custom string back if there was an error.

    -Jeff


    Jeff Sanders (MSFT)

    Wednesday, December 26, 2012 8:33 PM
    Moderator

All replies

  • Hi Renjie,

    You cannot trap custom exceptions in JavaScript.  Instead provide a mechanism to get a custom string back if there was an error.

    -Jeff


    Jeff Sanders (MSFT)

    Wednesday, December 26, 2012 8:33 PM
    Moderator
  • Hi Jeff,

    I understand that I cannot trap custom exceptions in JavaScript. But I don't understand why the exception is mapped to 0x80000004(No such interface supported). On C#, it shows as "System.Exception".

    Wednesday, December 26, 2012 9:45 PM
  • OK. That is because my error code is status = 4, so 0x80000000 | (int)(status) = 0x80000004

    In Winerror.h

    //
    // MessageId: E_NOINTERFACE
    //
    // MessageText:
    //
    // No such interface supported
    //
    #define E_NOINTERFACE                    _HRESULT_TYPEDEF_(0x80000004L)

    Is there any way to make my hresult is really unique so that it will not be recognized as a system defined error code.

    Wednesday, December 26, 2012 10:37 PM
  • After I set the C bit of the HResult, it seems OK now.

        if (ER_OK != status) {
            throw Platform::Exception::CreateException(0xC0000000 | (int)(status), "My Error message"));
        }

    http://en.wikipedia.org/wiki/HRESULT

    Wednesday, December 26, 2012 10:48 PM