InboxError
An enum describing errors that can occur when loading an InboxUI. Conforms to LocalizedError.
Enum Definition
Copied to your clipboardpublic enum InboxError: Int, Error {case dataUnavailable = 1case inboxSchemaDataNotFound = 2case invalidInboxSchemaData = 3case inboxCreationFailed = 4}
Cases
| Case | Raw Value | Description |
|---|---|---|
dataUnavailable | 1 | No proposition data was available for the requested surface. Typically occurs when updatePropositionsForSurfaces has not been called, or no campaigns are configured for the surface. |
inboxSchemaDataNotFound | 2 | A proposition was found for the surface but it did not contain an inbox schema item. |
invalidInboxSchemaData | 3 | An inbox schema item was found but its content could not be decoded into valid InboxSchemaData. |
inboxCreationFailed | 4 | An internal error occurred while creating the inbox. |
LocalizedError Conformance
InboxError provides human-readable descriptions via LocalizedError:
| Property | Description |
|---|---|
errorDescription | A short description of the error. |
failureReason | The reason the error occurred. |
recoverySuggestion | A suggested action to resolve the error. |
Example
Swift
Copied to your clipboardfunc onError(_ inbox: InboxUI, _ error: Error) {if let inboxError = error as? InboxError {switch inboxError {case .dataUnavailable:print("No content available. Call updatePropositionsForSurfaces first.")case .inboxSchemaDataNotFound:print("No inbox campaign is configured for this surface.")case .invalidInboxSchemaData:print("Inbox configuration data is malformed.")case .inboxCreationFailed:print("Internal error creating the inbox.")}}}
