merge: desktop section fixes (V-0, V-12, V-13, V-14)
Merge branch fix2/desktop-sections into the verification branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
23 files changed
+609
-75
No files matched your search
@@ -30,7 +30,27 @@ public sealed class ErrorTextTests
|
||||
// Failures that already carry a catalog sentence keep it.
|
||||
Assert.Equal(@"The archive D:\Shoots is offline.", ErrorText.ForServer(new ArchiveOfflineException(@"D:\Shoots", ArchiveAvailability.Offline)));
|
||||
Assert.Equal("Something went wrong.", ErrorText.ForServer(new InvalidOperationException("Sequence contains no elements")));
|
||||
Assert.Equal("Something went wrong.", ErrorText.ForServer(new TitanoApiException(HttpStatusCode.BadGateway, new ApiError("bad_gateway", " ", null))));
|
||||
Assert.Equal("Something went wrong.", ErrorText.ForServer(new TitanoApiException(HttpStatusCode.Conflict, new ApiError("conflict", " ", null))));
|
||||
Assert.Equal(Unreachable, ErrorText.ForServer(new TitanoApiException(HttpStatusCode.BadGateway, new ApiError("bad_gateway", " ", null))));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AReplyThatIsNotTheServersOwnSaysWhatItsStatusMeans()
|
||||
{
|
||||
// A reverse proxy answers for the server (the NAS setup): its page is no Titano JSON, so TitanoClient keeps only
|
||||
// the reason phrase, in English, which never reaches the screen.
|
||||
static TitanoApiException Proxy(HttpStatusCode status, string reason) => new(status, new ApiError("http_" + (int)status, reason));
|
||||
const string Unreachable = "The server does not answer; check the address and the network.";
|
||||
Assert.Equal(Unreachable, ErrorText.ForServer(Proxy(HttpStatusCode.BadGateway, "Bad Gateway")));
|
||||
Assert.Equal(Unreachable, ErrorText.ForServer(Proxy(HttpStatusCode.ServiceUnavailable, "Service Unavailable")));
|
||||
Assert.Equal(Unreachable, ErrorText.ForServer(Proxy(HttpStatusCode.GatewayTimeout, "Gateway Timeout")));
|
||||
Assert.Equal(Unreachable, ErrorText.For(Proxy(HttpStatusCode.BadGateway, "Bad Gateway")));
|
||||
Assert.Equal("The request is larger than the server accepts.", ErrorText.ForServer(Proxy(HttpStatusCode.RequestEntityTooLarge, "Request Entity Too Large")));
|
||||
Assert.Equal("Too many attempts; wait a minute and try again.", ErrorText.ForServer(Proxy(HttpStatusCode.TooManyRequests, "Too Many Requests")));
|
||||
Assert.Equal("Unexpected server error; try again.", ErrorText.ForServer(Proxy(HttpStatusCode.InternalServerError, "Internal Server Error")));
|
||||
Assert.Equal("Something went wrong.", ErrorText.ForServer(Proxy(HttpStatusCode.NotFound, "Not Found")));
|
||||
// JSON of another shape has no code: its message is not the server's either.
|
||||
Assert.Equal(Unreachable, ErrorText.ForServer(new TitanoApiException(HttpStatusCode.BadGateway, new ApiError(null!, "upstream connect error"))));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in new issue
Block a user