CXoneChatError

public enum CXoneChatError: LocalizedError, Equatable

The different types of errors that may be experienced.

Errors when calling any method

  • An attempt was made to use a method without connecting first.

    Most of the methods in the SDK require a connection to CXone services.

    • Source of problem: SDK used incorrectly.

      Attention

      Make sure you call connect() or connect() method first.

    Declaration

    Swift

    case notConnected
  • The method being called is not supported with the current channel configuration.

    Some features are available only with multithread channel configuration.

    • Source of problem: SDK used incorrectly.

      Attention

      The channel is configured as a single-thread and called method requires a feature of multi-thread configuration, e.g. create().

    Declaration

    Swift

    case unsupportedChannelConfig
  • The conversion from object instance to data failed.

    SDK is converting an object, like String, to the Data and the conversion failed.

    • Source of problem: SDK/DFO issue

    Attention

    Gather any information about how the error was encountered and contact the CXoneChat SDK team.

    Declaration

    Swift

    case invalidData
  • The provided ID for the thread was invalid, so the action could not be performed.

    The SDK tried to find required thread but it does not exist or it is no more available.

    • Source of problem: SDK used incorrectly

    Attention

    Check if thread exists and you are providing correct thread id which reffers to threadIdOnExternalPlatform.

    Declaration

    Swift

    case invalidThread
  • There aren’t any other messages, so additional messages could not be loaded.

    Attention

    Gather any information about how the error was encountered and contact the CXoneChat SDK team.

    Declaration

    Swift

    case noMoreMessages
  • The provided attachment was unable to be sent.

    CXone service does not receive any/all attachments.

    • Source of problem: Unstable connection/SDK issue

    Attention

    Check if channel environment works correctly or gather any information about how the error was encountered and contact the CXoneChat SDK team.

    Declaration

    Swift

    case attachmentError
  • The size of the attachment exceeds the allowed size

    Channel fileRestrictions define allowed file size which can be received by the backend

    • Source of problem: SDK used incorrectly

    Attention

    Attachments should be validated for correct file size by the host application

    Declaration

    Swift

    case invalidFileSize
  • The type of the attachment is not included in the allowed file MIME type

    Channel fileRestrictions define allowed file MIME types which can be received by the backned

    • Source of problem: SDK used incorrectly

    Attention

    Attachments should be validated for correct file type by the host application

    Declaration

    Swift

    case invalidFileType
  • The server experienced an internal error and was unable to perform the action.

    SDK failed to upload attachment(s).

    • Source of problem: Unstable connection/SDK issue

    Attention

    Check if channel environment works correctly or gather any information about how the error was encountered and contact the CXoneChat SDK team.

    Declaration

    Swift

    case serverError
  • The server experienced an error during recovering a messaging thread or server does not contain any existing chat thread.

    This error indicates that thread recovery failed, either because the thread does not exist or for some other server-specific cause.

    • Source of problem: Information error/DFO issue

    Warning

    The SDK throws this error even in case of empty thread list.

    Attention

    Can be ignored in case of empty thread list. Otherwise, gather any information about how the error was encountered and contact the CXoneChat SDK team.

    Declaration

    Swift

    case recoveringThreadFailed
  • The parameter has not been set properly or it was unable to unwrap it as a required type.

    The SDK tried to unwrap an object but it was missing. Could be internal object or data from the server.

    • Source of problem: DFO issue/SDK issue

    Attention

    Gather any information about how the error was encountered and contact the CXoneChat SDK team.

    Declaration

    Swift

    case missingParameter(String)
  • A invalid parameter has been passed to a method call.

    This is one of:

    • MessagesProvider.send(message:) was called with no valid postback, empty text, and no attachments.

    Declaration

    Swift

    case invalidParameter(String)
  • The brand has configured pre-chat survey with contact custom fields which needs to be provided via create(with:) method.

    • Source of problem: SDK used incorrectly

    Attention

    Fill-up custom fields available in the preChatSurvey and pass them as a parameter in the create(with:) method.

    Declaration

    Swift

    case missingPreChatCustomFields
  • A provided custom field does not have a definition in the case custom fields.

    CXone service handles only those custom fields that are configured in the brand settings and others are ignored.

    • Source of problem: SDK used incorrectly

    Attention

    Check content of the channelConfiguration, specifically ChannelConfiguration/contactCustomFieldDefinitions or your brand settings.

    Declaration

    Swift

    case unknownCaseCustomFields
  • A provided custom field does not have a definition in the customer custom fields.

    CXone service handles only those custom fields that are configured in the brand settings and others are ignored.

    • Source of problem: SDK used incorrectly

    Attention

    Check content of the channelConfiguration, specifically ChannelConfiguration/customerCustomFieldDefinitions or your brand settings.

    Declaration

    Swift

    case unknownCustomerCustomFields
  • The SDK instance could not get customer identity possibly because it may not have been set.

    Customer identity is necessary for binding threads to the visitor.

    • Source of problem: SDK used incorrectly/SDK issue

    Attention

    Gather any information about how the error was encountered and contact the CXoneChat SDK team.

    Declaration

    Swift

    case customerAssociationFailure

Errors when calling connect

  • The WebSocket refused to connect.

    This error may occur within connection establishing process and it can relate to several issues - wrong IDs, an internet or CXone service connectivity issue or wrong connection URL.

    • Source of problem: SDK used incorrectly/DFO issue

    Attention

    Check entered BrandID and ChannelID. If you are providing your own chatURL or socketURL, double check that these URLs are correct. Otherwise, Gather any information about how the error was encountered and contact the CXoneChat SDK team.

    Declaration

    Swift

    case webSocketConnectionFailure
  • The channel configuration could not be retrieved.

    This error may occur with getting channel configuration and it can relate to several issues - wrong IDs or wrong connection URL.

    • Source of problem: SDK used incorrectly

    Attention

    Check entered BrandID and ChannelID. If you are providing your own chatURL or socketURL, double check that these URLs are correct.

    Declaration

    Swift

    case channelConfigFailure
  • The customer was successfully authorized, but an access token wasn’t returned.

    The access token is used in case of OAuth authorization process.

    • Source of problem: DFO issue

    Attention

    Gather any information about how the error was encountered and contact the CXoneChat SDK team.

    Declaration

    Swift

    case missingAccessToken
  • The customer could not be associated with a visitor.

    Some events, except customer identity, uses visitorId to match an user.

    • Source of problem: SDK issue

    Attention

    Gather any information about how the error was encountered and contact the CXoneChat SDK team.

    Declaration

    Swift

    case customerVisitorAssociationFailure
  • The connection request was invalid and couldn’t be completed.

    connect() or connect() may throw this error in case of incorrectly set socket enpoint object.

    • Source of problem: SDK used incorrectly/SDK issue

    Attention

    Check entered IDs and URLs. Otherwise, gather any information about how the error was encountered and contact the CXoneChat SDK team.

    Declaration

    Swift

    case invalidRequest
  • Thread is missing the timestamp of when the message was created.

    Every thread message contains timestamp to be able to identify latest message for loading previously created and not yet loaded messages via loadMore(for:) method.

    • Source of problem: DFO issue

    Attention

    Gather any information about how the error was encountered and contact the CXoneChat SDK team.

    Declaration

    Swift

    case invalidOldestDate
  • An attached file could not be found.

    It has been stored in an unknown location or its location is not accessible from the secure scope and it is not handled.

    • Source of problem: SDK used incorrectly/SDK issue

    Attention

    Store your attachment in the secured scope or in the application documents directory. Otherwise, gather any information about how the error was encountered and contact the CXoneChat SDK team.

    Declaration

    Swift

    case noSuchFile(String)
  • An analytics event has been generated when no visit was available.

    Attention

    viewPage(title:url:) must be called before any other analytics events are generated

    Declaration

    Swift

    case missingVisitId
  • connect() or an analytics event has been generated when no visitor id was available.

    Attention

    prepare(environment:brandId:channelId:) or prepare(chatURL:socketURL:brandId:channelId:) must be called before connect() or any other analytics events are generated.

    Declaration

    Swift

    case missingVisitorId
  • Unable to trigger the required method because the SDK is not in the required state.

    The SDK has to be in correct state to trigger required operation. For example, connecting to the CXone service for chatting with an agent, it is firstly necessary to prepare(environment:brandId:channelId:) channel configuration which leads to the prepared state and then it’s possible to connect() to the websocket.

    Check ChatState for more information.

    Source of problem

    SDK used incorrectly

    Declaration

    Swift

    case illegalChatState
  • Unable to trigger the required method because the chat thread is not in the required state.

    The chat thread has to be in correct state to trigger required operation. For example, to update thread name via updateName(_:for:) the thread can not be in closed state.

    Check ChatThreadState for more information.

    Source of problem

    SDK used incorrectly

    Declaration

    Swift

    case illegalThreadState

Properties

Methods

  • Declaration

    Swift

    public static func == (lhs: Self, rhs: Self) -> Bool