diff --git a/backend/src/common/filters/http-exception.filter.ts b/backend/src/common/filters/http-exception.filter.ts index 126086f0..ce88081f 100644 --- a/backend/src/common/filters/http-exception.filter.ts +++ b/backend/src/common/filters/http-exception.filter.ts @@ -92,19 +92,19 @@ export class CustomHttpExceptionFilter implements ExceptionFilter { if (!msg) return 'خطای نامشخص رخ داده است.'; const lower = msg.toLowerCase(); - if (lower.includes('unauthorized') || status === 401) { + if (lower === 'unauthorized' || msg === 'Unauthorized') { return 'شما دسترسی لازم برای این عملیات را ندارید. لطفاً ابتدا وارد حساب کاربری خود شوید.'; } - if (lower.includes('forbidden') || status === 403) { + if (lower === 'forbidden' || msg === 'Forbidden') { return 'دسترسی شما به این بخش یا منبع محدود شده است.'; } - if (lower.includes('not found') || status === 404) { + if (lower === 'not found' || msg === 'Not Found') { return 'مورد یا صفحه درخواستی یافت نشد.'; } - if (status === 400) { + if (lower === 'bad request' || msg === 'Bad Request') { return 'درخواست نامعتبر است. لطفاً پارامترهای ورودی را چک کنید.'; } - if (status === 429) { + if (lower === 'too many requests' || msg === 'ThrottlerException: Too Many Requests') { return 'تعداد درخواست‌های شما بیش از حد مجاز است. لطفاً کمی صبر کرده و مجدداً تلاش کنید.'; }