-
Notifications
You must be signed in to change notification settings - Fork 77
/
errors.ts
83 lines (76 loc) · 2.65 KB
/
errors.ts
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* tslint:disable:max-classes-per-file */
// Error codes indicating the reason for an error.
export enum PURCHASES_ERROR_CODE {
UNKNOWN_ERROR = "0",
PURCHASE_CANCELLED_ERROR = "1",
STORE_PROBLEM_ERROR = "2",
PURCHASE_NOT_ALLOWED_ERROR = "3",
PURCHASE_INVALID_ERROR = "4",
PRODUCT_NOT_AVAILABLE_FOR_PURCHASE_ERROR = "5",
PRODUCT_ALREADY_PURCHASED_ERROR = "6",
RECEIPT_ALREADY_IN_USE_ERROR = "7",
INVALID_RECEIPT_ERROR = "8",
MISSING_RECEIPT_FILE_ERROR = "9",
NETWORK_ERROR = "10",
INVALID_CREDENTIALS_ERROR = "11",
UNEXPECTED_BACKEND_RESPONSE_ERROR = "12",
RECEIPT_IN_USE_BY_OTHER_SUBSCRIBER_ERROR = "13",
INVALID_APP_USER_ID_ERROR = "14",
OPERATION_ALREADY_IN_PROGRESS_ERROR = "15",
UNKNOWN_BACKEND_ERROR = "16",
INVALID_APPLE_SUBSCRIPTION_KEY_ERROR = "17",
INELIGIBLE_ERROR = "18",
INSUFFICIENT_PERMISSIONS_ERROR = "19",
PAYMENT_PENDING_ERROR = "20",
INVALID_SUBSCRIBER_ATTRIBUTES_ERROR = "21",
LOG_OUT_ANONYMOUS_USER_ERROR = "22",
CONFIGURATION_ERROR = "23",
UNSUPPORTED_ERROR = "24",
EMPTY_SUBSCRIBER_ATTRIBUTES_ERROR = "25",
PRODUCT_DISCOUNT_MISSING_IDENTIFIER_ERROR = "26",
PRODUCT_DISCOUNT_MISSING_SUBSCRIPTION_GROUP_IDENTIFIER_ERROR = "28",
CUSTOMER_INFO_ERROR = "29",
SYSTEM_INFO_ERROR = "30",
BEGIN_REFUND_REQUEST_ERROR = "31",
PRODUCT_REQUEST_TIMED_OUT_ERROR = "32",
API_ENDPOINT_BLOCKED = "33",
INVALID_PROMOTIONAL_OFFER_ERROR = "34",
OFFLINE_CONNECTION_ERROR = "35",
}
export interface PurchasesError {
code: PURCHASES_ERROR_CODE;
message: string;
// @deprecated
// access readableErrorCode through userInfo.readableErrorCode
readableErrorCode: string;
userInfo: ErrorInfo;
underlyingErrorMessage: string;
// @deprecated
// use code === Purchases.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR instead
userCancelled: boolean | null;
}
export interface ErrorInfo {
readableErrorCode: string;
}
/**
* @internal
*/
export class UninitializedPurchasesError extends Error {
constructor() {
super("There is no singleton instance. " +
"Make sure you configure Purchases before trying to get the default instance. " +
"More info here: https://errors.rev.cat/configuring-sdk");
// Set the prototype explicitly.
Object.setPrototypeOf(this, UninitializedPurchasesError.prototype);
}
}
/**
* @internal
*/
export class UnsupportedPlatformError extends Error {
constructor() {
super("This method is not available in the current platform.");
// Set the prototype explicitly.
Object.setPrototypeOf(this, UnsupportedPlatformError.prototype);
}
}