fix(import): say what a proxy's reply means instead of its English reason phrase
A reply that is not the server's JSON (a reverse proxy's 502 page while the container restarts, its 413 for a large body, a bare 500) reached the Import screen as the HTTP reason phrase, in English, beside every photo. ErrorText now uses an ApiError's message only when the server wrote it (a code that is not TitanoClient's http_<status> fallback) and otherwise says what the status means: too large, rate limited, not answering (gateway and timeout statuses) or a server error. A card file that cannot be read while planning is listed with the executor's catalog sentence instead of the system's text and full path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
6 files changed
+97
-6
No files matched your search
@@ -62,7 +62,10 @@ public static class CardScanner
|
||||
return files;
|
||||
}
|
||||
|
||||
/// <summary>Reads light metadata of every file; unreadable files become <paramref name="problems"/>.</summary>
|
||||
/// <summary>
|
||||
/// Reads light metadata of every file; unreadable files become <paramref name="problems"/>, each with one localized
|
||||
/// sentence (the system's text goes to the log only).
|
||||
/// </summary>
|
||||
public static IReadOnlyList<CardPhoto> ReadMetadata(string root, IReadOnlyList<CardFile> files, List<ImportProblem> problems,
|
||||
IProgress<int>? progress = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -78,7 +81,7 @@ public static class CardScanner
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
Log.Warning("import", $"Cannot read {file.RelativePath}", ex);
|
||||
problems.Add(new ImportProblem(file.RelativePath, ex.Message));
|
||||
problems.Add(new ImportProblem(file.RelativePath, ImportExecutor.FailureText(ex)));
|
||||
}
|
||||
progress?.Report(i + 1);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user