A error.number.toString(16) does not work.
This "-2147014836" should be translated to 0x8007274c.
So we have to do some math:
(hresult < 0 ? (0xFFFFFFFF +
hresult + 1) :
hresult).toString(16)
or
Number.prototype.toHRESULT = function() {
return (this < 0 ? (0xFFFFFFFF + this
+ 1) : this).toString(16);
}
Then you can do if (error instanceof WinRTError) return error.number.toHRESULT() to use that as a key to a translation file or log it.