refactor: update error handling to use unknown type for better type safety

This commit is contained in:
Wikid82
2025-11-25 22:08:54 +00:00
parent 5bfa2975be
commit a3c164a394
8 changed files with 46 additions and 78 deletions

View File

@@ -141,10 +141,11 @@ export default function ProxyHostForm({ host, onSubmit, onCancel }: ProxyHostFor
try {
await onSubmit(formData)
} catch (err: any) {
} catch (err: unknown) {
console.error("Submit error:", err)
// Extract error message from axios response if available
const message = err.response?.data?.error || err.message || 'Failed to save proxy host'
const errorObj = err as { response?: { data?: { error?: string } }; message?: string }
const message = errorObj.response?.data?.error || errorObj.message || 'Failed to save proxy host'
setError(message)
} finally {
setLoading(false)