WinRTError Object (JavaScript)


When a Windows Runtime call returns an HRESULT that indicates a failure, JavaScript converts it to a special Windows Runtime error. It is available only in Windows 8.x Store apps, when the Windows Runtime is available, as part of the global JavaScript namespace.

errorObj = new WinRTError();

The WinRTError error type is used only for errors that originate in Windows Runtime APIs.


The following example shows how a WinRTError is thrown and caught.

try {
        } catch (err) {
            var n = err;

The WinRTError object has no methods.

The WinRTError object has the same properties as the Error Object (JavaScript) object.


The WinRTError object is supported only in Windows 8.x Store apps, not in Internet Explorer.