# 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.

- `urlErrorDataKey`

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

  #### Declaration

  Swift

      public static let urlErrorDataKey: String

- `httpCodeErrorDataKey`

  Metadata key used for storing an HTTP status code inside `data`.

  #### Declaration

  Swift

      public static let httpCodeErrorDataKey: String

### Public

- `severity`

  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

- `category`

  `ErrorCategory` defines a set of categories representing the broad classification of errors within the SDK.

  #### Declaration

  Swift

      public let category: ErrorCategory

- `type`

  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

- `message`

  A human-readable description of the error.

  #### Declaration

  Swift

      public fileprivate(set) var message: String { get }

- `data`

  Optional additional information about the error, represented as key-value pairs.

  #### Declaration

  Swift

      public fileprivate(set) var data: [String : String] { get }

- `parentError`

  The underlying error that caused this error, if any.

  #### Declaration

  Swift

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

### PRESTOerror

- `addDetailedMessage(_:)`

  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.

- `addParentError(_:)`

  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.

- `addData(_:)`

  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.

- `addSeverity(_:)`

  Returns a copy of the error with a modified severity.

  #### Declaration

  Swift

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

  #### Parameters

  `severity` | Severity level to assign.

- `addNativeError(_:)`

  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.