fix(import): say why a photo was not copied with a catalog sentence

A photo the executor could not copy now carries one localized sentence
(ImportExecutor.FailureText: its own checks, a full destination, access
denied, else "The photo could not be read or copied.") on the Import
screen and in the import job's log. The photos a stopped folder or
server import never reached show the stop's cause (ImportFailures.Stop:
the server's own sentence, not answering, untrusted certificate, card
gone, destination full or not writable), and a failed index check reads
"The index could not be read or written.". A refusal without words
reads as the catalog's sentence. The system's text stays in the log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-12 15:53:49 +00:00
1 parent 32a0e9bbc1
commit 5cf918ed66
11 files changed
+132 -17

No files matched your search

@@ -31,6 +31,22 @@ public sealed class ImportFailuresTests
Assert.Equal("The import stopped before the end.", ImportFailures.Import(new InvalidDataException("Bad sidecar. Second sentence."), Card));
}
[Test]
public void TheCopiesAStoppedImportNeverReachedSayWhyInOneSentence()
{
const string Card = "EOS R5 · card A";
Assert.Equal("EOS R5 · card A is no longer available.", ImportFailures.Stop(new ImportSourceUnavailableException(@"E:\"), Card));
Assert.Equal("The destination is full.", ImportFailures.Stop(new IOException("There is not enough space on the disk.", unchecked((int)0x80070070)), Card));
Assert.Equal("Titano may not write to the destination.", ImportFailures.Stop(new UnauthorizedAccessException(@"Access to D:\Shoots is denied."), Card));
Assert.Equal("The import stopped before the end.", ImportFailures.Stop(new IOException("The specified network name is no longer available."), Card));
// The server's own sentence, else why it could not be asked.
Assert.Equal("Sign in again",
ImportFailures.Stop(new TitanoApiException(HttpStatusCode.Unauthorized, new ApiError("unauthorized", "Sign in again", null)), Card));
Assert.Equal(Loc.L("Server.Error.Unreachable"), ImportFailures.Stop(new HttpRequestException("An error occurred while sending the request."), Card));
Assert.Equal(Loc.L("Server.Error.Unreachable"), ImportFailures.Stop(new TaskCanceledException("The operation was canceled."), Card));
Assert.Equal(Loc.L("Server.Error.Untrusted"), ImportFailures.Stop(new UntrustedCertificateException("AB:CD"), Card));
}
[Test]
public void APlanningFailureNamesTheSource()
{