diff --git a/static/gsAdmin/views/relocationCreate.tsx b/static/gsAdmin/views/relocationCreate.tsx index 4921189efe30..12128a7fb0df 100644 --- a/static/gsAdmin/views/relocationCreate.tsx +++ b/static/gsAdmin/views/relocationCreate.tsx @@ -45,20 +45,18 @@ 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); + return; + } + throw error; + } } // Start the relocation.