|
| 1 | +// |
| 2 | +// FlutterError+Custom.swift |
| 3 | +// Pods-Runner |
| 4 | +// |
| 5 | +// Created by Ilya Virnik on 6/21/20. |
| 6 | +// |
| 7 | + |
| 8 | +#if canImport(FlutterMacOS) |
| 9 | +import FlutterMacOS |
| 10 | +#else |
| 11 | +import Flutter |
| 12 | +#endif |
| 13 | + |
| 14 | +extension FlutterError { |
| 15 | + static private let passValidValue = "Please make sure you pass a valid value" |
| 16 | + |
| 17 | + static let noArgs = FlutterError(code: "0", |
| 18 | + message: "Could not find call arguments", |
| 19 | + details: "Make sure you pass Map as call arguments") |
| 20 | + |
| 21 | + static let noApiKey = FlutterError(code: "1", |
| 22 | + message: "Could not find API key", |
| 23 | + details: passValidValue) |
| 24 | + |
| 25 | + static let noUserId = FlutterError(code: "2", |
| 26 | + message: "Could not find userID", |
| 27 | + details: passValidValue) |
| 28 | + |
| 29 | + static let noAutoTrackPurchases = FlutterError(code: "3", |
| 30 | + message: "Could not find autoTrackPurchases boolean value", |
| 31 | + details: passValidValue) |
| 32 | + |
| 33 | + static let noData = FlutterError(code: "4", |
| 34 | + message: "Could not find data", |
| 35 | + details: passValidValue) |
| 36 | + |
| 37 | + static let noProvider = FlutterError(code: "5", |
| 38 | + message: "Could not find provider", |
| 39 | + details: passValidValue) |
| 40 | + |
| 41 | + static func failedToGetProducts(_ description: String) -> FlutterError { |
| 42 | + return FlutterError(code: "7", |
| 43 | + message: "Failed to get products", |
| 44 | + details: description) |
| 45 | + } |
| 46 | + |
| 47 | + static let noProductId = FlutterError(code: "8", |
| 48 | + message: "Could not find productId value", |
| 49 | + details: "Please provide valid productId") |
| 50 | + |
| 51 | + static func qonversionError(_ description: String) -> FlutterError { |
| 52 | + return FlutterError(code: "9", |
| 53 | + message: "Qonversion Error", |
| 54 | + details: description) |
| 55 | + } |
| 56 | + |
| 57 | + static func parsingError(_ description: String) -> FlutterError { |
| 58 | + return FlutterError(code: "12", |
| 59 | + message: "Arguments Parsing Error", |
| 60 | + details: description) |
| 61 | + } |
| 62 | + |
| 63 | + static let noProperty = FlutterError(code: "13", |
| 64 | + message: "Could not find property", |
| 65 | + details: passValidValue) |
| 66 | + |
| 67 | + static let noPropertyValue = FlutterError(code: "14", |
| 68 | + message: "Could not find property value", |
| 69 | + details: passValidValue) |
| 70 | + |
| 71 | + static func offeringsError(_ description: String) -> FlutterError { |
| 72 | + return FlutterError(code: "OFFERINGS", |
| 73 | + message: "Could not get offerings", |
| 74 | + details: description) |
| 75 | + } |
| 76 | + |
| 77 | + static let noSdkInfo = FlutterError(code: "15", |
| 78 | + message: "Could not find sdk info", |
| 79 | + details: passValidValue) |
| 80 | +} |
0 commit comments