debug: 관리함 저장 오류 디버깅 - 상세 로그 추가
🐛 Debug Enhancement: - 프론트엔드: 요청/응답 상세 로그 추가 - 백엔드: 각 단계별 디버그 로그 추가 - 에러 메시지 개선 (JSON 파싱 포함) 🔍 Frontend Debugging: - console.log로 전송 데이터 확인 - response.text()로 원본 에러 메시지 확인 - JSON 파싱 실패 시 원본 텍스트 표시 🔧 Backend Debugging: - 요청 데이터 로그 출력 - 각 필드 처리 과정 로그 - 데이터베이스 커밋 과정 로그 - 상세한 에러 메시지 제공 Expected Result: ✅ 422 오류의 정확한 원인 파악 가능 ✅ 프론트엔드에서 전송하는 데이터 확인 ✅ 백엔드에서 처리 과정 추적 ✅ 구체적인 에러 메시지로 빠른 문제 해결
This commit is contained in:
@@ -956,6 +956,8 @@
|
||||
}
|
||||
});
|
||||
|
||||
console.log('Sending updates:', updates);
|
||||
|
||||
// API 호출
|
||||
const response = await fetch(`/api/issues/${issueId}/management`, {
|
||||
method: 'PUT',
|
||||
@@ -966,15 +968,26 @@
|
||||
body: JSON.stringify(updates)
|
||||
});
|
||||
|
||||
console.log('Response status:', response.status);
|
||||
|
||||
if (response.ok) {
|
||||
alert('변경사항이 저장되었습니다.');
|
||||
await loadIssues(); // 목록 새로고침
|
||||
} else {
|
||||
const error = await response.json();
|
||||
throw new Error(error.detail || '저장에 실패했습니다.');
|
||||
const errorText = await response.text();
|
||||
console.error('API Error Response:', errorText);
|
||||
let errorMessage = '저장에 실패했습니다.';
|
||||
try {
|
||||
const errorJson = JSON.parse(errorText);
|
||||
errorMessage = errorJson.detail || JSON.stringify(errorJson);
|
||||
} catch (e) {
|
||||
errorMessage = errorText || '저장에 실패했습니다.';
|
||||
}
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('저장 실패:', error);
|
||||
console.error('Error details:', error);
|
||||
alert(error.message || '저장 중 오류가 발생했습니다.');
|
||||
}
|
||||
}
|
||||
@@ -1128,6 +1141,8 @@
|
||||
updates.completion_photo = base64;
|
||||
}
|
||||
|
||||
console.log('Modal sending updates:', updates);
|
||||
|
||||
// API 호출
|
||||
const response = await fetch(`/api/issues/${currentModalIssueId}/management`, {
|
||||
method: 'PUT',
|
||||
@@ -1138,16 +1153,27 @@
|
||||
body: JSON.stringify(updates)
|
||||
});
|
||||
|
||||
console.log('Modal response status:', response.status);
|
||||
|
||||
if (response.ok) {
|
||||
alert('변경사항이 저장되었습니다.');
|
||||
closeIssueDetailModal();
|
||||
await loadIssues(); // 목록 새로고침
|
||||
} else {
|
||||
const error = await response.json();
|
||||
throw new Error(error.detail || '저장에 실패했습니다.');
|
||||
const errorText = await response.text();
|
||||
console.error('Modal API Error Response:', errorText);
|
||||
let errorMessage = '저장에 실패했습니다.';
|
||||
try {
|
||||
const errorJson = JSON.parse(errorText);
|
||||
errorMessage = errorJson.detail || JSON.stringify(errorJson);
|
||||
} catch (e) {
|
||||
errorMessage = errorText || '저장에 실패했습니다.';
|
||||
}
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('저장 실패:', error);
|
||||
console.error('모달 저장 실패:', error);
|
||||
console.error('Error details:', error);
|
||||
alert(error.message || '저장 중 오류가 발생했습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user