fix(app): keep the editor's own save errors and gate an unread archive
- Editor: a failed save showed what the server or the archive layer would say
for the exception's type, so the editor's own sentences were lost: frames
changed on the server or settings changed elsewhere read "The server does not
answer", a read-only account or a gone sequence "Something went wrong". These
failures are now EditorException (an IOException; ProxiesOutdatedException
derives from it) and the toast shows their sentence as it is. A project
written by a newer Titano is reported with the same sentence as a corrupt one
instead of the parser's English text.
- Library: a job posted to a server whose certificate changed since sign-in
threw out of the action unreported; the pin's refusal now reaches the error
toast ("The certificate was not trusted").
- Archive: picking another archive forced it offline until it was read, so the
rebuild dialog called it offline with the previous archive's count, and
disabled commands said the archive must be online. What was read is now kept
apart from availability: until the picked archive is read, Rebuild and the
online commands wait and say so, health fixes and search results of the
previous archive are cleared, and a running search is cancelled.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
15 files changed
+218
-31
No files matched your search
@@ -4,6 +4,7 @@ using Titano.Core.Archiving;
|
||||
using Titano.Core.Codecs.Jpeg;
|
||||
using Titano.Core.Imaging;
|
||||
using Titano.Core.Imaging.Decoders;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Metadata;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Core.Project;
|
||||
@@ -147,7 +148,8 @@ public sealed class ProjectStoreTests(TestContext context)
|
||||
new ArchiveServiceOptions { Owner = "test", LeaseWait = TimeSpan.FromSeconds(20) });
|
||||
var content = await source.LoadAsync(context.Cancellation);
|
||||
Assert.True(await db.Sequences.DeleteAsync(sequenceId));
|
||||
await Assert.ThrowsAsync<InvalidOperationException>(() => source.SaveProjectAsync(content.Project with { HeroFrame = 1 }, content.Project, context.Cancellation));
|
||||
var gone = await Assert.ThrowsAsync<EditorException>(() => source.SaveProjectAsync(content.Project with { HeroFrame = 1 }, content.Project, context.Cancellation));
|
||||
Assert.Equal(Loc.L("Editor.Error.Missing"), gone.Message, "the toast shows the editor's own sentence");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,8 +180,15 @@ public sealed class ProjectStoreTests(TestContext context)
|
||||
var path = Path.Combine(root, "Synthetic", ".titano", "project.json");
|
||||
File.WriteAllText(path, "{ not json");
|
||||
await using var source = new LocalSequenceSource(db, sequenceId, DecoderFactory.CreateClient(null), null);
|
||||
await Assert.ThrowsAsync<InvalidDataException>(() => source.LoadAsync(context.Cancellation));
|
||||
var unreadable = await Assert.ThrowsAsync<EditorException>(() => source.LoadAsync(context.Cancellation));
|
||||
Assert.Equal(Loc.L("Editor.Error.Project"), unreadable.Message);
|
||||
Assert.Equal("{ not json", File.ReadAllText(path));
|
||||
|
||||
// A project written by a newer Titano reads the same, not as the parser's English sentence.
|
||||
var newer = $"{{\"version\":{ProjectSettings.CurrentVersion + 1}}}";
|
||||
File.WriteAllText(path, newer);
|
||||
Assert.Equal(Loc.L("Editor.Error.Project"), (await Assert.ThrowsAsync<EditorException>(() => source.LoadAsync(context.Cancellation))).Message);
|
||||
Assert.Equal(newer, File.ReadAllText(path));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user