Skip to content

Commit

Permalink
[ZEUS-4472] Updated documentation for reason code returned by SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
KharchenkoAlex committed Jul 18, 2024
1 parent 781bf4a commit 9d41cb3
Showing 1 changed file with 44 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,47 @@
import Foundation

public enum PlayBackAPIError: Error {

case invalidResponsePlaybackData

case invalidPlaybackDataURL

case invalidPlayerInformationURL

case initializationError

case loadHLSStreamError

case networkError(Error)

case apiError(statusCode: Int, message: String)
// Define reason codes returned by Playback SDK
public enum PlaybackErrorReason: Equatable {
// Http error 400
case headerError
case badRequestError
case siteNotFound
case configurationError
case apiKeyError
case mpPartnerError

// Http error 401
case tokenError
case tooManyDevices
case tooManyRequests
case noEntitlement
case noSubscription
case noActiveSession
case notAuthenticated

// Http error 404
case noEntityExist

// Unknown error with associated custom message
case unknownError(String)

init(fromString value: String) {
switch value.uppercased() {
case "HEADER_ERROR": self = .headerError
case "BAD_REQUEST_ERROR": self = .badRequestError
case "SITE_NOT_FOUND": self = .siteNotFound
case "CONFIGURATION_ERROR": self = .configurationError
case "API_KEY_ERROR": self = .apiKeyError
case "MP_PARTNER_ERROR": self = .mpPartnerError
case "TOKEN_ERROR": self = .tokenError
case "TOO_MANY_DEVICES": self = .tooManyDevices
case "TOO_MANY_REQUESTS": self = .tooManyRequests
case "NO_ENTITLEMENT": self = .noEntitlement
case "NO_SUBSCRIPTION": self = .noSubscription
case "NO_ACTIVE_SESSION": self = .noActiveSession
case "NOT_AUTHENTICATED": self = .notAuthenticated
case "NO_ENTITY_EXIST": self = .noEntityExist
default: self = .unknownError(value)
}
}
}

0 comments on commit 9d41cb3

Please sign in to comment.