usrrootkali commited on
Commit
c1f8e4f
·
verified ·
1 Parent(s): 2da8e52

Update src/components/SettingsModal.tsx

Browse files
Files changed (1) hide show
  1. src/components/SettingsModal.tsx +16 -0
src/components/SettingsModal.tsx CHANGED
@@ -9,6 +9,7 @@ import {
9
  ExternalLink,
10
  Sparkles,
11
  } from 'lucide-react';
 
12
 
13
  interface SettingsModalProps {
14
  isOpen: boolean;
@@ -60,10 +61,25 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
60
  setTestStatus('success');
61
  setTestMessage(`Authenticated successfully as @${data.name || data.fullname || 'user'}!`);
62
  } else {
 
 
 
 
 
 
 
 
 
63
  setTestStatus('error');
64
  setTestMessage(`HF authentication failed (${res.status}). Verify your token permissions.`);
65
  }
66
  } catch (e: any) {
 
 
 
 
 
 
67
  setTestStatus('error');
68
  setTestMessage(`Connection error: ${e.message || 'Network request failed'}`);
69
  }
 
9
  ExternalLink,
10
  Sparkles,
11
  } from 'lucide-react';
12
+ import { logRealConsoleApiError } from '../utils/apiLogger';
13
 
14
  interface SettingsModalProps {
15
  isOpen: boolean;
 
61
  setTestStatus('success');
62
  setTestMessage(`Authenticated successfully as @${data.name || data.fullname || 'user'}!`);
63
  } else {
64
+ const errBody = await res.text().catch(() => '');
65
+ logRealConsoleApiError({
66
+ topic: 'Hugging Face Token Authentication Error',
67
+ endpoint: 'https://huggingface.co/api/whoami-v2',
68
+ status: res.status,
69
+ statusText: res.statusText,
70
+ message: `Authentication failed with status ${res.status} (${res.statusText || 'Unauthorized'})`,
71
+ rawResponse: errBody,
72
+ });
73
  setTestStatus('error');
74
  setTestMessage(`HF authentication failed (${res.status}). Verify your token permissions.`);
75
  }
76
  } catch (e: any) {
77
+ logRealConsoleApiError({
78
+ topic: 'Hugging Face Token Validation Network Failure',
79
+ endpoint: 'https://huggingface.co/api/whoami-v2',
80
+ message: e.message || 'Network request failed or CORS blocked.',
81
+ error: e,
82
+ });
83
  setTestStatus('error');
84
  setTestMessage(`Connection error: ${e.message || 'Network request failed'}`);
85
  }