PushException

Package 

com.salesforce.marketingcloud.pushmodels.exceptions

Description 

Exception thrown when there is an error in the push module. This is the base exception for all push exceptions.

Class Declaration 

1open class PushException(
2    val errorCode: PushException.ErrorCode,
3    val message: String? = null
4) : Exception

Constructors 

Primary Constructor 

1constructor(
2    errorCode: PushException.ErrorCode,
3    message: String? = null
4)

Parameters:

  • errorCode - The error code enum value indicating the type of push error
  • message - Optional error message string (nullable, defaults to null)

Properties 

errorCode 

1val errorCode: PushException.ErrorCode

The error code associated with this exception.

message 

1open override val message: String?

The optional error message describing the exception.

Methods 

toJson 

1fun toJson(): JSONObject

Returns the error message as a JSON object to be sent to the server.

Returns: A JSONObject representation of the error

Nested Types 

ErrorCode 

1enum ErrorCode : Enum<PushException.ErrorCode>

Enum defining the various error codes for push exceptions.

Enum Values 

  • UNKNOWN_ERROR - Represents an unspecified or unknown error condition
  • INVALID_JSON - Indicates a JSON parsing or validation error
  • INVALID_COMPRESSION - Signifies an issue with data compression
  • MISSING_FIELD - Denotes a required field is absent
  • UNSUPPORTED_TYPE - Indicates an unsupported data or content type
  • BAD_MEDIA - Represents an error related to media content

Properties 

  • entries - Returns an immutable list of all enum entries in declaration order (type: EnumEntries<PushException.ErrorCode>)

Methods 

  • valueOf(value: String) - Returns the enum constant matching the specified name (exact match required)
  • values() - Returns an array of all constants in this enum type

Inheritors 

The following classes inherit from PushException:

  • InvalidJsonException
  • InvalidCompressionException
  • MissingFieldException
  • UnsupportedWidgetException
  • UnknownErrorException
  • BadMediaException

Module Information 

  • Part of: Salesforce Marketing Cloud Unified SDK
  • Module: Push Models Module v1.0.2
  • SDK Version: 11.0.0
  • Platform: androidJvm