diff --git a/app/static/js/sync.js b/app/static/js/sync.js index 1e8374b..3b95957 100644 --- a/app/static/js/sync.js +++ b/app/static/js/sync.js @@ -192,12 +192,10 @@ const Sync = { } catch (fetchErr) { clearTimeout(timeoutId); if (fetchErr.name === 'AbortError') { - throw new Error('Upload timed out (' + (this.UPLOAD_TIMEOUT_MS / 1000) + 's)'); + throw new Error('Upload timed out'); } - // Capture detailed error info for debugging - const errDetail = fetchErr.name + ': ' + fetchErr.message; - console.error('[SYNC] Fetch threw:', errDetail); - throw new Error('Network error: ' + errDetail); + console.error('[SYNC] Fetch threw:', fetchErr.name, fetchErr.message); + throw new Error('Connection lost - will retry'); } clearTimeout(timeoutId); @@ -253,13 +251,12 @@ const Sync = { } catch (error) { this._setUploading(false); - const errMsg = (error.name || 'Error') + ': ' + error.message; - console.error('[SYNC] Upload failed:', errMsg, '(attempt', retryCount + 1 + ')'); + console.error('[SYNC] Upload failed:', error.message, '(attempt', retryCount + 1 + ')'); await Storage.updatePhoto(photo.id, { status: 'pending', retryCount: retryCount + 1, - lastError: errMsg, - error: errMsg + lastError: error.message, + error: error.message }); return false; } diff --git a/app/templates/queue.html b/app/templates/queue.html index 394448f..970d679 100644 --- a/app/templates/queue.html +++ b/app/templates/queue.html @@ -500,7 +500,7 @@ function createQueueItem(photo, isCompleted) { badge.textContent = photo.status.charAt(0).toUpperCase() + photo.status.slice(1); status.appendChild(badge); - if (photo.retryCount > 0 && !isCompleted) { + if (photo.retryCount >= 3 && !isCompleted) { const retry = document.createElement('span'); retry.className = 'retry-info'; retry.textContent = 'Retry #' + photo.retryCount; @@ -511,8 +511,11 @@ function createQueueItem(photo, isCompleted) { info.appendChild(meta); info.appendChild(status); + // Only show error messages after 3+ retries or for failed status + // (first couple of retries are usually transient network blips) const errorMsg = photo.lastError || photo.error; - if (errorMsg && photo.status !== 'verified') { + const retries = photo.retryCount || 0; + if (errorMsg && photo.status !== 'verified' && (retries >= 3 || photo.status === 'failed')) { const error = document.createElement('div'); error.className = 'error-message'; error.textContent = errorMsg;