From aea889aa35b3b2024aa609805292cce8aa06578b Mon Sep 17 00:00:00 2001 From: "sentry[bot]" <39604003+sentry[bot]@users.noreply.github.com> Date: Thu, 1 Oct 2026 22:43:37 +0000 Subject: [PATCH] ref(gsAdmin): Convert promo code API call to try/catch --- static/gsAdmin/views/relocationCreate.tsx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/static/gsAdmin/views/relocationCreate.tsx b/static/gsAdmin/views/relocationCreate.tsx index 4921189efe30..a79956c2d5c1 100644 --- a/static/gsAdmin/views/relocationCreate.tsx +++ b/static/gsAdmin/views/relocationCreate.tsx @@ -45,20 +45,20 @@ function RelocationForm() { // Verify that the promo code exists, has remaining claims, etc. const promoCode = formData.get('promo_code'); if (typeof promoCode === 'string' && promoCode) { - await promoCodeApi - .requestPromise(`/promocodes-external/${promoCode}`, { + try { + await promoCodeApi.requestPromise(`/promocodes-external/${promoCode}`, { method: 'GET', host: cell.locality_url, - }) - .catch(error => { - if (error instanceof RequestError && error.status === 403) { - addErrorMessage(PROMO_CODE_ERROR_MSG); - - // Ensure that the wrapping `catch` block doesn't try to re-print this error message. - // eslint-disable-next-line unicorn/error-message - throw new Error(); - } }); + } catch (error) { + if (error instanceof RequestError && error.status === 403) { + addErrorMessage(PROMO_CODE_ERROR_MSG); + + // Ensure that the wrapping `catch` block doesn't try to re-print this error message. + // eslint-disable-next-line unicorn/error-message + throw new Error(); + } + } } // Start the relocation.