SDKError

The SDKError class represents an extended JavaScript Error class that is returned upon failure for all IronWeb SDKs that return Promises. This custom error class has the same properties as the normal JavaScript Error class but also exposes a code property that represents one of the unique Error Codes that can occur.

Properties

Property Value Description
message string Readable error message.
code number Numerical error code that represents a unique [Error Code](/ironweb-sdk/error-codes) for the operation that failed.
rawError Error Original, unaltered JavaScript Error instance that this custom Error class wrapped.

Example

import {ErrorCodes, document} from '@ironcorelabs/ironweb';

document.decryptFromStore('323')
    .then(() => {})
    .catch((error) => {
        //The 'error' variable is an instance of an SDKError
        if(error.code === ErrorCodes.DOCUMENT_DECRYPT_FAILURE){...}
    })