|
5 | 5 | //
|
6 | 6 |
|
7 | 7 | import Foundation
|
| 8 | +import ReadiumShared |
8 | 9 |
|
9 | 10 | public enum LCPError: LocalizedError {
|
10 |
| - // The operation can't be done right now because another License operation is running. |
| 11 | + /// The license could not be retrieved because the passphrase is unknown. |
| 12 | + case missingPassphrase |
| 13 | + |
| 14 | + /// The given file is not an LCP License Document (LCPL). |
| 15 | + case notALicenseDocument(FileURL) |
| 16 | + |
| 17 | + /// The operation can't be done right now because another License operation is running. |
11 | 18 | case licenseIsBusy
|
12 |
| - // An error occured while checking the integrity of the License, it can't be retrieved. |
| 19 | + |
| 20 | + /// An error occured while checking the integrity of the License, it can't be retrieved. |
13 | 21 | case licenseIntegrity(LCPClientError)
|
14 |
| - // The status of the License is not valid, it can't be used to decrypt the publication. |
| 22 | + |
| 23 | + /// The status of the License is not valid, it can't be used to decrypt the publication. |
15 | 24 | case licenseStatus(StatusError)
|
16 |
| - // Can't read or write the License Document from its container. |
| 25 | + |
| 26 | + /// Can't read or write the License Document from its container. |
17 | 27 | case licenseContainer(ContainerError)
|
18 |
| - // The interaction is not available with this License. |
| 28 | + |
| 29 | + /// The interaction is not available with this License. |
19 | 30 | case licenseInteractionNotAvailable
|
20 |
| - // This License's profile is not supported by liblcp. |
| 31 | + |
| 32 | + /// This License's profile is not supported by liblcp. |
21 | 33 | case licenseProfileNotSupported
|
22 |
| - // Failed to renew the loan. |
| 34 | + |
| 35 | + /// Failed to renew the loan. |
23 | 36 | case licenseRenew(RenewError)
|
24 |
| - // Failed to return the loan. |
| 37 | + |
| 38 | + /// Failed to return the loan. |
25 | 39 | case licenseReturn(ReturnError)
|
26 | 40 |
|
27 |
| - // Failed to retrieve the Certificate Revocation List. |
| 41 | + /// Failed to retrieve the Certificate Revocation List. |
28 | 42 | case crlFetching
|
29 | 43 |
|
30 |
| - // Failed to parse information from the License or Status Documents. |
| 44 | + /// Failed to parse information from the License or Status Documents. |
31 | 45 | case parsing(ParsingError)
|
32 |
| - // A network request failed with the given error. |
| 46 | + |
| 47 | + /// A network request failed with the given error. |
33 | 48 | case network(Error?)
|
34 |
| - // An unexpected LCP error occured. Please post an issue on r2-lcp-swift with the error message and how to reproduce it. |
| 49 | + |
| 50 | + /// An unexpected LCP error occured. Please post an issue on r2-lcp-swift with the error message and how to reproduce it. |
35 | 51 | case runtime(String)
|
36 |
| - // An unknown low-level error was reported. |
| 52 | + |
| 53 | + /// An unknown low-level error was reported. |
37 | 54 | case unknown(Error?)
|
38 | 55 |
|
39 | 56 | public var errorDescription: String? {
|
40 | 57 | switch self {
|
| 58 | + case .missingPassphrase: return nil |
| 59 | + case .notALicenseDocument: return nil |
41 | 60 | case .licenseIsBusy:
|
42 | 61 | return ReadiumLCPLocalizedString("LCPError.licenseIsBusy")
|
43 | 62 | case let .licenseIntegrity(error):
|
|
0 commit comments