Error Handling Reference - React Native

Reference documentation for error handling in the Agentforce Mobile SDK for React Native.

Errors are thrown as JavaScript Error objects with a code property. Catch them in Promise rejections:

CodeSourceDescription
INVALID_CONFIGconfigure, registerViewProviderMissing or invalid configuration fields. Missing type field, invalid type value, missing required fields, or empty componentMap.
CONFIG_ERRORconfigureConfiguration failed at the native SDK level (for example, network error, invalid credentials).
NOT_CONFIGUREDlaunchConversation, startNewConversationconfigure() was not called before attempting to launch.
LAUNCH_ERRORlaunchConversation (iOS)Failed to start the conversation session. Often indicates wrong serviceApiURL (400) or server error (500).
START_NEW_ERRORstartNewConversation (iOS)Failed to start a new conversation.
ERRORlaunchConversation, startNewConversation (Android)General Android error (Activity not available, initialization failure).
INVALID_CONTEXTsetAdditionalContextMissing variables array or a variable lacks name/type.
NO_CONVERSATIONsetAdditionalContextNo active conversation. Must call launchConversation() first.
CONTEXT_ERRORsetAdditionalContextThe native SDK rejected the context.
INVALID_FIELDSregisterHiddenPreChatFields (iOS)Fields are not a valid string-to-string map.
CodeSourceDescription
NO_ACTIVITYlogin, refreshAuthCredentials (Android)No current Activity available.
NOT_AVAILABLElogin, refreshAuthCredentials (Android)Salesforce SDK not initialized.
LOGIN_FAILEDlogin (Android)No credentials obtained after login flow.
REFRESH_FAILEDrefreshAuthCredentials (Android)No credentials available after refresh.
ERRORVarious (Android)General error with message.

The bridge performs client-side validation before sending to native:

  1. The context object must have a variables array.
  2. Each variable must have a non-empty name (string) and type (string).
  3. The type must be one of: Text, Number, Boolean, Date, DateTime, Json, List, Money, Object, Ref, Variable.

If validation fails, a synchronous Error is thrown before the native call.

MethodiOS Error CodeAndroid Error Code
launchConversation failureLAUNCH_ERRORERROR
startNewConversation failureSTART_NEW_ERRORERROR
Invalid hidden prechat fieldsINVALID_FIELDS(not validated)