PRESTOerror Class

public class PRESTOerror : NSObject, CustomNSError

Error Interface ‘PRESTOerror’ is a generic interface that represents all error types thrown within the SDK. This class provides a unified way to handle, classify, and propagate errors encountered during SDK operations, ensuring that any error, regardless of its origin or context, can be managed consistently by client applications. Use this class to catch, inspect, and respond to SDK-specific failures, facilitating robust error handling across your codebase.

  • Metadata key used for storing a related request URL inside data.

    Declaration

    Swift

    public static let urlErrorDataKey: String
  • Metadata key used for storing an HTTP status code inside data.

    Declaration

    Swift

    public static let httpCodeErrorDataKey: String

Public

  • Represents the severity level of an error, indicating how critical the error is and what kind of action may be needed.

    Declaration

    Swift

    public let severity: ErrorSeverity
  • ErrorCategory defines a set of categories representing the broad classification of errors within the SDK.

    Declaration

    Swift

    public let category: ErrorCategory
  • Enumerates all possible error types that may occur within the SDK, including licensing, network, DRM, storage, playback, and other system-level errors.

    Declaration

    Swift

    public let type: ErrorType
  • A human-readable description of the error.

    Declaration

    Swift

    public fileprivate(set) var message: String { get }
  • Optional additional information about the error, represented as key-value pairs.

    Declaration

    Swift

    public fileprivate(set) var data: [String : String] { get }
  • The underlying error that caused this error, if any.

    Declaration

    Swift

    public fileprivate(set) var parentError: Error? { get }

PRESTOerror

  • Returns a copy of the error with an attached detailed message.

    Declaration

    Swift

    public func addDetailedMessage(_ message: String) -> PRESTOerror

    Parameters

    message

    Human-readable details for troubleshooting.

  • Returns a copy of the error with an attached parent error.

    Declaration

    Swift

    public func addParentError(_ error: any Error) -> PRESTOerror

    Parameters

    error

    Source error to embed.

  • Returns a copy of the error with replaced metadata payload.

    Declaration

    Swift

    public func addData(_ data: [String : String]) -> PRESTOerror

    Parameters

    data

    Key-value metadata to attach.

  • Returns a copy of the error with a modified severity.

    Declaration

    Swift

    public func addSeverity(_ severity: ErrorSeverity) -> PRESTOerror

    Parameters

    severity

    Severity level to assign.

  • Returns a copy of the error with metadata extracted from NSError.

    Declaration

    Swift

    public func addNativeError(_ nsError: NSError) -> PRESTOerror

    Parameters

    nsError

    Native platform error to map.