-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ZEUS-4472] Updated documentation for reason code returned by SDK
- Loading branch information
1 parent
781bf4a
commit 9d41cb3
Showing
1 changed file
with
44 additions
and
15 deletions.
There are no files selected for viewing
59 changes: 44 additions & 15 deletions
59
Sources/PlaybackSDK/Documentation.docc/Resources/PlayBackAPIError.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} |