Export (0) Print
Expand All

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 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 {
            Windows.Storage.ApplicationData.localFolder.createFileAsync("sample.txt");
        } 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 Store apps, not in Internet Explorer.

Show:
© 2014 Microsoft