Add fetch timeout/retry, friendly error messages, and VAT rate constant

- fetchWithTimeout (10s) + fetchWithRetry (3 attempts, exponential backoff)
- DataError class with type classification (config/network/auth/timeout/unknown)
- User-friendly error messages in EN/AR instead of raw error strings
- Extract VAT_RATE constant (was hardcoded 1.15)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
fahed
2026-03-25 18:08:24 +03:00
parent ed29e7c22c
commit 8934ba1e51
5 changed files with 103 additions and 26 deletions

View File

@@ -149,6 +149,13 @@
"district": "المنطقة",
"captureRate": "نسبة الاستقطاب"
},
"errors": {
"config": "لم يتم تهيئة لوحة المعلومات. يرجى إعداد اتصال NocoDB.",
"network": "لا يمكن الوصول إلى خادم قاعدة البيانات. يرجى التحقق من اتصالك بالإنترنت.",
"auth": "تم رفض الوصول. قد يكون رمز API غير صالح أو منتهي الصلاحية.",
"timeout": "خادم قاعدة البيانات يستغرق وقتاً طويلاً للاستجابة. يرجى المحاولة مرة أخرى.",
"unknown": "حدث خطأ أثناء تحميل البيانات. يرجى المحاولة مرة أخرى."
},
"language": {
"switch": "EN"
},

View File

@@ -149,6 +149,13 @@
"district": "District",
"captureRate": "Capture Rate"
},
"errors": {
"config": "The dashboard is not configured. Please set up the NocoDB connection.",
"network": "Cannot reach the database server. Please check your internet connection.",
"auth": "Access denied. The API token may be invalid or expired.",
"timeout": "The database server is taking too long to respond. Please try again.",
"unknown": "Something went wrong while loading data. Please try again."
},
"language": {
"switch": "عربي"
},