summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPN/Extensions/SKError+Localized.swift
blob: 32a0cb6501552dae4619b9fa90b2743bc3c1a6f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//
//  SKError+Localized.swift
//  MullvadVPN
//
//  Created by pronebird on 17/01/2023.
//  Copyright © 2025 Mullvad VPN AB. All rights reserved.
//

import StoreKit

extension SKError: Foundation.LocalizedError {
    public var errorDescription: String? {
        switch code {
        case .unknown:
            return NSLocalizedString("Unknown error.", comment: "")
        case .clientInvalid:
            return NSLocalizedString("Client is not allowed to issue the request.", comment: "")
        case .paymentCancelled:
            return NSLocalizedString("The payment request was cancelled.", comment: "")
        case .paymentInvalid:
            return NSLocalizedString("Invalid purchase identifier.", comment: "")
        case .paymentNotAllowed:
            return NSLocalizedString("This device is not allowed to make the payment.", comment: "")
        default:
            return localizedDescription
        }
    }
}