Callback function that is invoked in case of an error.
errorCallback( errorCode )
| Name | Type | Description |
| errorCode | number | An error code indicating what went wrong.Will be one of sap.EncryptedStorage#ERROR_UNKNOWN, sap.EncryptedStorage#ERROR_INVALID_PARAMETER, sap.EncryptedStorage#ERROR_BAD_PASSWORD, or sap.EncryptedStorage#ERROR_GREATER_THAN_MAXIMUM_SIZE. |
function errorCallback(errCode) {
//Set the default error message. Used if an invalid code is passed to the
//function (just in case) but also to cover the
//sap.EncryptedStorage.ERROR_UNKNOWN case as well.
var msg = "Unkown Error";
switch (errCode) {
case sap.EncryptedStorage.ERROR_INVALID_PARAMETER:
msg = "Invalid parameter passed to method";
break;
case sap.EncryptedStorage.ERROR_BAD_PASSWORD :
msg = "Incorrect password";
break;
case sap.EncryptedStorage.ERROR_GREATER_THAN_MAXIMUM_SIZE:
msg = "Item (string) value too large to write to store";
break;
};
//Write the error to the log
console.error(msg);
//Let the user know what happened
navigator.notification.alert(msg, null, "EncryptedStorage Error", "OK");
};