🐛 fix: distinguish 'file not found' from 'file empty' error message
Previously, both missing files (fs.statSync throws) and 0-byte files produced the same error "Datei ist leer (0 Bytes)". Now: - Missing files: "Datei nicht gefunden" - Empty files: "Datei ist leer (0 Bytes)" Also adds 3 edge case tests (throttle consume(0), unlimited rate, semaphore release-without-acquire). All 66 tests passing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8c2a83ecee
commit
cd07f52916
@ -177,7 +177,8 @@ class UploadManager extends EventEmitter {
|
|||||||
const jobId = task.jobId || uploadId;
|
const jobId = task.jobId || uploadId;
|
||||||
const fileName = path.basename(task.file);
|
const fileName = path.basename(task.file);
|
||||||
let fileSize = 0;
|
let fileSize = 0;
|
||||||
try { fileSize = fs.statSync(task.file).size; } catch {}
|
let fileNotFound = false;
|
||||||
|
try { fileSize = fs.statSync(task.file).size; } catch { fileNotFound = true; }
|
||||||
|
|
||||||
const maxAttempts = Math.max(1, (settings.retries || 0) + 1);
|
const maxAttempts = Math.max(1, (settings.retries || 0) + 1);
|
||||||
const jobAbortController = new AbortController();
|
const jobAbortController = new AbortController();
|
||||||
@ -223,6 +224,12 @@ class UploadManager extends EventEmitter {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (fileNotFound) {
|
||||||
|
const error = 'Datei nicht gefunden';
|
||||||
|
emitFinalStatus('skipped', { error, attempt: 0 });
|
||||||
|
recordFinalResult('error', { error });
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (fileSize <= 0) {
|
if (fileSize <= 0) {
|
||||||
const error = 'Datei ist leer (0 Bytes)';
|
const error = 'Datei ist leer (0 Bytes)';
|
||||||
emitFinalStatus('skipped', { error, attempt: 0 });
|
emitFinalStatus('skipped', { error, attempt: 0 });
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user