fix: add type guard for detail property in error data
- Check for 'detail' property before accessing it - Maintain all error handling functionality - Ensure TypeScript type safety Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -230,7 +230,7 @@ function SettingsForm({ me, onBack }: { me: MemberRead; onBack: () => void }) {
|
||||
} else if (typeof err === 'object' && err !== null && 'status' in err && 'data' in err) {
|
||||
// Try to extract more details from the error object
|
||||
console.error("Error details:", JSON.stringify(err));
|
||||
if (err.status === 422 && err.data && err.data.detail) {
|
||||
if (err.status === 422 && err.data && 'detail' in err.data) {
|
||||
errorMessage = err.data.detail;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user