InboxError
An enum describing errors that can occur when loading an InboxUI. Conforms to LocalizedError.
Enum Definition
public enum InboxError: Int, Error {
case dataUnavailable = 1
case inboxSchemaDataNotFound = 2
case invalidInboxSchemaData = 3
case inboxCreationFailed = 4
}
Cases
Case
Raw Value
Description
dataUnavailable1No proposition data was available for the requested surface. Typically occurs when
updatePropositionsForSurfaces has not been called, or no campaigns are configured for the surface.inboxSchemaDataNotFound2A proposition was found for the surface but it did not contain an inbox schema item.
invalidInboxSchemaData3An inbox schema item was found but its content could not be decoded into valid
InboxSchemaData.inboxCreationFailed4An internal error occurred while creating the inbox.
LocalizedError Conformance
InboxError provides human-readable descriptions via LocalizedError:
Property
Description
errorDescriptionA short description of the error.
failureReasonThe reason the error occurred.
recoverySuggestionA suggested action to resolve the error.
Example
data-slots=heading, code
data-repeat=1
data-languages=Swift
Swift
func 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.")
}
}
}