Sync ORM API Guide: Sync Client Error Codes

Handling Errors

Kony Fabric Sync Framework handles error handling through error codes. All the ORMs take errorCallback as a parameter that is called if any error occurs in that particular ORM. All ORMs return error parameter in errorCallback that is mapped and contains the following keys:

  1. errorCode[number]: Each error is assigned a specific error code.

  2. errorMessage[String]: Description of the error scenario.

  3. errorInfo[JSObject]:Other information about error. It may also contain intermediate errors.

Kony Fabric Sync Client Error Codes

Following table describes various client error codes and corresponding error messages:

Error Code Error Scenario Error Message
7001 Invalid data type passed for some ORM Invalid data type for the attribute <attribute global name> in <Sync Object globalname>. Expected: <expected Type> Actual:<actual Type>
7002 Mandatory Attribute Missing in the Sync Object Mandatory Attribute <attribute global name> missing in the Sync Object <Sync Object globalname>
7003 Primary Key not specified in updating an item in Sync Object Primary Key <primaryKey> not specified in updating an item in <Sync Object globalname>.
7004 Scopes loading failed Scopes loading failed.
7005 Sync Reset failed Sync Reset failed.
7006 Register device failed Register device failed.
7007 Session breaks because of some scope failure Session breaks since user scope failure.
7008 Session in progress Session in progress.
7009 No data with specified primary key found in local database while doing performing some operation on a Sync Object No data with specified primary key found in <Sync Object globalname>.
7010 Transaction failed to open Transaction failed
7011 Error occurred while establishing a Database connection. Error occurred while establishing a Database connection.
7012 If some record is created with markforupload=false, you should update it with markforupload=false only, else updates go to server for some non-existent server record and merge fails Record does not exist on server, mark it for upload before updating/deleting it.
7013 Error during Deferred Upload Transaction Error during Deferred Upload Transaction
7014 Referential Integrity Constraints Violation Referential Integrity Constraints Violation: <Target Attribute> = < Target Value> does not exists in <Target Object>.
7015 Length exceeds specified limit while creating/updating a record Length exceeds the limit for the attribute <attribute global name> in <Sync Object globalname>. Expected: <Expected Length> Actual: <Actual Length>
7016 If user tries to create a record with already existing primary key. Primary Key <attribute global name> already exists in table <Sync Object globalname>. Please give different value of primary key.
7018 Some malicious values like positive/negative infinities, NaN is passed in some create/update operation Malicious value <value> given for attribute <attribute global name>.
7019 Some error occurs while executing SQL statement Some error occurred in executing SQL statement
7020 Error occurred while Uploading changes to Server Error occurred in Uploading changes to Server
7021 Error occurs while Downloading changes from Sever Error occurred in Downloading changes from Sever
7022 Error occurs while syncing one or more scopes Error occurred while syncing one or more scopes
7028 Error occurs if markforUpload value is set to true. markforUpload value can not be made true if the object is created with mark for upload as false. If the user tries to change an object with markForUpload value from false to true using update or updateByPK APIs, the following error is occurred.
7777 Some random error The following error occurred while performing <operation Name> : <error>. Possible reasons can be sync.init may not have been invoked.[This comes for random error]
8888 Unknown error from server Unknown error from server
1000   Unknown Error while connecting (If the platform cannot differentiate between the various kinds of network errors, the platform reports this error code by default)
1011   Device has no WIFI or mobile connectivity. Please try the operation after establishing connectivity.
1012   Request Failed
1013   Middleware returned invalid JSON string
1014   Request Timed out
1015   Cannot find host
1016   Cannot connect to host
1022   Service call is canceled. You can customize the behavior of the application if a service call is canceled.
1200   SSL - Certificate related error codes.

 

Note: 7022 is a generic error from client side which will be shown for different scenarios as described in Sync Server Error Codes section.

Kony Fabric Sync Server Error Codes

Following table describes various server error codes and corresponding error messages:

Error Code Error Scenario Error Message
1001 User credentials are incorrect Invalid userID or password.
1002 Not an authorized user for the application. A user is not assigned to the application. Application not authorized to the user.
1003 A user's deviceId is invalid or does not exist in a registered device list at the Kony Fabric Sync server. Invalid deviceID.
1004 SyncConfig xml corresponding to applicationID not found at the Kony Fabric Sync Server. Unknown applicationID.
1005 A userID does not exist in a registered device list at the Kony Fabric Sync Server. Unknown userID.
1006 A user is not registered to the Kony Fabric Sync Server with this deviceID A device is not assigned to a user.
1008 Empty deviceID in the request. Empty deviceID.
1010 Other authentication errors not already listed Unknown error occurred, error message : <errMsg>.
SY3001E The current client app is built on an old sync config. An application with version <app version> for application ID <applicationId> is not the latest one. Please upgrade the application.
SY3002E A sync config on which the client is built is not uploaded to the Kony Fabric Sync Server or overridden with the new version. An application with version <app version> for application ID <applicationId> was not found in the application history.
SY3003E A client app version sent from the device is null or empty. A client application version for applicationID <applicationId> is null or empty.
SY3004E A server app version in sync config that is uploaded is null or empty. A server application version for applicationID <applicationId> is null or Empty.
SY3005E The sync config that is uploaded to Sync Server differs from the sync config on which app is built on. The client application version <Client App version> for applicationID <applicationId> is not matching to server application version <Server App version>.
SY0000E There are two scenarios,
1. After a successful sync, you delete the device using the sync console and repeat the sync operation.
2. Re-install the Sync Console DB, and upload SyncConfig.xml call sync.startsession() without reset()
DeviceID <deviceID> does not exist.
  Different strategies selected for client and server ( app is built on the sync config that has a different strategy from the uploaded sync config ). Strategy mismatch server = <strategy-defined in syncconfig>, client = <client strategy>.
  During the sync download, chunk packets are corrupted due to network interruptions. CheckSum not matched with the server calculated checksum for the payload <payloadId>
  When the Kony Fabric Sync Server processes the request, the HTTP session times out. Request failed due to session timeout
  It is a safe measure to protect the illegal access Found invalid Application ID for this session
  It is a safe measure for the format issues in the dynamic schema upgrade. Invalid selected sync object format
  It is a safe measure for the client context format coming from device. Invalid client context
  Batch size passed must be greater than zero. Invalid batch size : <batch size> must be greater than zero.
  Replica database version and the sync config uploaded to the Kony Fabric Sync Server are not the same. (Make sure that the persistent database is created with the latest sync config). Replica version mismatch with server-side.
  Sync strategy is from client is not OTA and persistent. Unknown sync strategy
  UserID and password combination is incorrect. Authentication failed with given userID and password.
  It is a safe measure to protect the illegal access Found invalid ApplicationID for this session
  It is a safe measure to protect the illegal access Found invalid UserID for this session
  It is a safe measure to protect the illegal access Found invalid DeviceID for this session
  sync.home is not set properly or syncservice.properties not found in the sync.home location Cannot find the properties file syncservice.properties. Please set a valid sync.home to continue.
  sync.home is not set properly. syncservice.properties not found in the sync.home location, or the file may be corrupted. Failed to create instance for ServicesConfigProperties in context initialization.
  sync.home is not set to properly. syncservice.properties not found in the sync.home location, or the file may be corrupted. Error occurs while reading syncservice.properties file.

Kony Fabric Sync Error Callbacks

Kony Fabric Sync Error Callbacks (both Upload and Download) provide exact messages of the error that occur at Kony Fabric Sync Server during the synchronization. You can use these error messages to display on the device application for the end user for further debugging. For the developer, the whole java stack trace is available in the response for debugging.

Example

Upload failed: Error occurred while upload on SyncObject 'Contact' : Unable to create/update fields: Name. Check the security settings of this field and verify that it is read/write for your profile or permission set.

Handling SOAP Fault Error

Kony Fabric Sync Server will by default raise an error if it encounters a SOAP Fault element in the Web Service response. A typical SOAP Fault element looks like,

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode>
<faultstring xsi:type="xsd:string"> Failed to locate method …. </faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

If the Web Service returns error using standard SOA Body element, then the developer can still raise errors providing an XPATH (or relevant extraction expression) for the attribute 'errmsg'.

Example:

Handling Timeout Error

When backend services are taking more time to respond during download batch files, we can pass the following optional context variables from client side to handle the timeouts between the device and Kony Fabric Sync server:

  1. BATCH_TIMEOUT: (The value in passed in milliseconds) indicates to Kony Fabric Sync server to forcefully respond back to device with the response data retrieved from backend datasource within this time. For example, if the http timeout between device and Kony Fabric Sync server is 60 seconds, then you may set this value as 50 seconds assuming 10 seconds is network delay between device and Kony Fabric Sync server.

    Note: Network delay between device and Kony Fabric Sync server is not considered in this timeout value.

  2. BATCH_SERVICE_COUNT_LIMIT: Numeric value indicating the maximum number of backend datasource calls allowed in a download batch. If this value is 'n' then Kony Fabric Sync server will make maximum of 'n' calls in a download batch.

Example

function ondownloadstartCallback(outputparams){
showSyncLoadingScreen("Download Started")
var req = outputparams.downloadRequest;
if(req.clientcontext===undefined){
req.clientcontext = {};
}
req.clientcontext.BATCH_SERVICE_COUNT_LIMIT = 3;
req.clientcontext.BATCH_TIMEOUT = 50000;
return req;
}
Copyright © 2013 Kony, Inc. All rights reserved.