Files

32 lines
955 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const MANUAL_EKAP_URL = 'https://ekap.kik.gov.tr/EKAP/';
export function sourceFailure(error) {
const rawMessage = error?.message || 'Resmi belge kaynağına ulaşılamadı.';
const humanVerification = error?.code === 'HUMAN_VERIFICATION_REQUIRED'
|| /HUMAN_VERIFICATION_REQUIRED|(?:EKAP|KİK)[^\n]{0,120}(?:HTTP\s*)?428|HTTP\s*428/i.test(rawMessage);
if (humanVerification) {
return {
status: 428,
body: {
success: false,
error: 'EKAP güvenlik doğrulaması gerekiyor. EKAP’ı kendi tarayıcınızda açıp doğrulamayı tamamlayın; ardından indirdiğiniz dokümanı bu ihaleye yükleyin.',
code: 'HUMAN_VERIFICATION_REQUIRED',
retryable: false,
manualAction: true,
manualUrl: MANUAL_EKAP_URL,
},
};
}
return {
status: 502,
body: {
success: false,
error: rawMessage,
code: 'SOURCE_UNAVAILABLE',
retryable: true,
},
};
}