From 4cac4e739852b6539f7c2bab5da36acc2ef5f20d Mon Sep 17 00:00:00 2001 From: Zersk Date: Tue, 3 Dec 2024 00:12:19 +0100 Subject: [PATCH] Improve error message details in checkout component Enhanced error handling by including specific error details from the server response when available. This change aims to provide more informative feedback to users encountering issues during the checkout process. --- archigator/src/app/checkout/checkout.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/archigator/src/app/checkout/checkout.component.ts b/archigator/src/app/checkout/checkout.component.ts index 795e14c..534cb75 100644 --- a/archigator/src/app/checkout/checkout.component.ts +++ b/archigator/src/app/checkout/checkout.component.ts @@ -217,7 +217,9 @@ export class CheckoutComponent implements OnInit { if (error.status === 403 || error.status === 422) { console.log(`Error with status ${error.status}:`, error.message); - this.errorMessage = `Error ${error.status}: ${error.message}`; + const errDetail = error.error?.detail || 'An error occurred'; + + this.errorMessage = `Error ${error.status}: ${errDetail}`; this.spinLoader = false; }