# Failure

class Failure<S, C>(val errorCode: C, val errorMessage: String, val details: List<ErrorDetails> = emptyList(), val debugCode: String, val debugMessage: String) : Result<S, C>

Failed operation result, containing detailed description of the cause.

#### Parameters

errorCode

Error code of an unsuccessful operation. Use this error code to appropriately handle the failure.

errorMessage

Error message with the cause of failure intended for end users.

details

More detailed descriptions of the error(s) causing the failure, if available. In many cases these are the actual errors returned from a server call. It is possible for a failure to happen without more detail that provided by the other fields, and this will be an empty list in such cases. (For example, error code NOT_AUTHORIZED has no additional details, the developer simply needs to call AuthorizationManager.authorize() before using the failing Mobile Payments SDK method).

debugCode

More detailed "debug" error code for troubleshooting the failure. Intended for developers only.

debugMessage

More detailed error message containing additional debug information related to the possible cause of the failure. Intended for developers only.

## Constructors

Failure
Link copied to clipboard
constructor(errorCode: C, errorMessage: String, details: List<ErrorDetails> = emptyList(), debugCode: String, debugMessage: String)

## Properties

debugCode
Link copied to clipboard
val debugCode: String
debugMessage
Link copied to clipboard
val debugMessage: String
details
Link copied to clipboard
val details: List<ErrorDetails>
errorCode
Link copied to clipboard
val errorCode: C
errorMessage
Link copied to clipboard
val errorMessage: String

## Functions

debugCode
Link copied to clipboard
fun debugCode(): String

More detailed "debug" error code for troubleshooting the failure

debugMessage
Link copied to clipboard
fun debugMessage(): String

Human-readable message containing additional debug information related to the possible cause of the failure.

details
Link copied to clipboard
fun details(): List<ErrorDetails>

More detailed descriptions of the error(s) causing the failure, if available. In many cases these are the actual errors returned from a server call. It is possible for a failure to happen without more detail that provided by the other fields, and this will be an empty list in such cases. (For example, error code NOT_AUTHORIZED has no additional details, the developer simply needs to call AuthorizationManager.authorize() before using the failing Mobile Payments SDK method).

errorCode
Link copied to clipboard
fun errorCode(): C

Error code of an unsuccessful operation

errorMessage
Link copied to clipboard
fun errorMessage(): String

Displayable message that summarizes the possible cause of the failure.

isFailure
Link copied to clipboard
fun isFailure(): Boolean

`true` if the operation resulted in a failure. For details see errorCode, errorMessage, debugCode and debugMessage.

isSuccess
Link copied to clipboard
fun isSuccess(): Boolean

`true` if the operation was successful. See value for the result.

value
Link copied to clipboard
fun value(): S

Result of a successful operation.