diff options
| author | Joe Carstairs <65492573+Sycamost@users.noreply.github.com> | 2023-08-08 07:22:46 +0100 |
|---|---|---|
| committer | Joe Carstairs <65492573+Sycamost@users.noreply.github.com> | 2023-08-08 07:22:46 +0100 |
| commit | 2871b154a0bf49eb18d460bf62488fe969252dd6 (patch) | |
| tree | 4907009088688bc34a3ce9710a7ede87dff8997c /api-src | |
| parent | d90bd2b84a7693e3b46e680a7316c6f229efc84c (diff) | |
Doesn't try-catch twice
Diffstat (limited to 'api-src')
| -rw-r--r-- | api-src/createPaypalOrder.ts | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/api-src/createPaypalOrder.ts b/api-src/createPaypalOrder.ts index 9d15071..182bf50 100644 --- a/api-src/createPaypalOrder.ts +++ b/api-src/createPaypalOrder.ts @@ -18,14 +18,9 @@ export default async function handler(request: VercelRequest, response: VercelRe } else { try { const paypalResponse = await paypalCreateOrder({ productDescription, shortDescription, totalPrice }); - - if (paypalResponse.ok) { - response.status(200).json({ - orderId: paypalResponse.id, - }); - } else { - throw new Error(`PayPal returned ${paypalResponse.statusCode} ${paypalResponse.statusMessage}`); - } + response.status(200).json({ + orderId: paypalResponse.id, + }); } catch (err) { response.status(500).send(`Internal server error. ${err}`); } |
