From 2ac46151f8ff8d24cf62d38804b71ec9fd5ec20e Mon Sep 17 00:00:00 2001 From: Kristina <7614497+khjrtbrg@users.noreply.github.com> Date: Mon, 14 Jul 2025 10:26:52 +0200 Subject: [PATCH] Merge pull request #26996 from overleaf/kh-include-region-in-errors [web] improve errors thrown from StripeClient & PaymentService GitOrigin-RevId: 59319936cc0caa876d80b068aac324dfe469b343 --- .../app/src/Features/Subscription/Errors.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/services/web/app/src/Features/Subscription/Errors.js b/services/web/app/src/Features/Subscription/Errors.js index 609ec15a73..ee474fa710 100644 --- a/services/web/app/src/Features/Subscription/Errors.js +++ b/services/web/app/src/Features/Subscription/Errors.js @@ -1,3 +1,5 @@ +// @ts-check + const Errors = require('../Errors/Errors') const OError = require('@overleaf/o-error') @@ -28,17 +30,41 @@ class HasPastDueInvoiceError extends OError {} class HasNoAdditionalLicenseWhenManuallyCollectedError extends OError {} +/** + * @typedef {Object} PaymentActionRequiredInfo + * @property {string} PaymentActionRequiredInfo.clientSecret + * @property {string} PaymentActionRequiredInfo.publicKey + */ class PaymentActionRequiredError extends OError { + /** + * @param {PaymentActionRequiredInfo} info + */ constructor(info) { super('Payment action required', info) } } +/** + * @typedef {Object} PaymentFailedInfo + * @property {string} PaymentFailedInfo.subscriptionId + * @property {string} PaymentFailedInfo.reason + * @property {string} PaymentFailedInfo.adviceCode + */ +class PaymentFailedError extends OError { + /** + * @param {PaymentFailedInfo} info + */ + constructor(info) { + super('Failed to process payment', info) + } +} + module.exports = { RecurlyTransactionError, DuplicateAddOnError, AddOnNotPresentError, PaymentActionRequiredError, + PaymentFailedError, MissingBillingInfoError, ManuallyCollectedError, PendingChangeError,