app-store-server-api
Version:
A client for the App Store Server API
27 lines (26 loc) • 854 B
JavaScript
/**
* See https://developer.apple.com/documentation/appstoreserverapi/error_codes
* for a list of all errors.
*/
export class AppStoreError extends Error {
constructor(errorCode, errorMessage, retryAfter) {
super(errorMessage);
this.errorCode = errorCode;
this.isRetryable = AppStoreError.RETRYABLE_ERRORS.includes(errorCode);
this.isRateLimitExceeded = errorCode === 4290000;
this.retryAfter = retryAfter;
}
}
// The following errors indicate that the request can be tried again.
AppStoreError.RETRYABLE_ERRORS = [
4040002,
4040004,
5000001,
4040006 // OriginalTransactionIdNotFoundRetryableError
];
export class CertificateValidationError extends Error {
constructor(certificates) {
super("Certificate validation failed");
this.certificates = certificates;
}
}