How to customize Exception in WinRT that would be consumed in JS


  • We need to throw customized exceptions in WinRT that could be handled in JavaScript.
    According to below quotation, COMException is a good option.
    We could pass a custom HRESULT and judge that code in JS. 
    But it seems that we could not specify custom message ... any way out?


    You can throw any exception type that's defined by the Windows Runtime. You cannot derive custom types from any Windows Runtime exception type. However, you can throw COMException and provide a custom HRESULT that can be accessed by the code that catches the exception. There's no way to specify a custom Message in a COMException.

    Tuesday, March 13, 2012 3:51 PM


All replies