mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-01 21:29:02 +00:00
cli: classify ssh cache errors in DiskCache
This commit is contained in:
@@ -253,10 +253,9 @@ fn runInner(
|
||||
|
||||
if (cache) |c| {
|
||||
const cached = c.contains(alloc, dest) catch |err| cached: {
|
||||
// An invalid key is a bad destination, not a bad cache.
|
||||
if (err != error.InvalidCacheKey) warnPrint(
|
||||
if (DiskCache.isFailure(err)) warnPrint(
|
||||
stderr,
|
||||
"unable to add '{s}' to the cache: {t}",
|
||||
"unable to read the cache '{s}': {t}",
|
||||
.{ c.path, err },
|
||||
);
|
||||
break :cached false;
|
||||
@@ -319,23 +318,21 @@ fn runInner(
|
||||
.real,
|
||||
).toSeconds())) |_| {
|
||||
verbosePrint(opts, stderr, "cache: wrote {s}", .{entry.dest});
|
||||
} else |err| switch (err) {
|
||||
// An uncacheable destination was already reported above, and a
|
||||
// lock held by a concurrent `+ssh` resolves itself.
|
||||
error.InvalidCacheKey,
|
||||
error.CacheLocked,
|
||||
=> verbosePrint(
|
||||
opts,
|
||||
stderr,
|
||||
"cache: skipped {s}: {t}",
|
||||
.{ entry.dest, err },
|
||||
),
|
||||
|
||||
else => warnPrint(
|
||||
stderr,
|
||||
"unable to add '{s}' to the cache '{s}': {t}",
|
||||
.{ entry.dest, entry.cache.path, err },
|
||||
),
|
||||
} else |err| {
|
||||
if (DiskCache.isFailure(err)) {
|
||||
warnPrint(
|
||||
stderr,
|
||||
"unable to add '{s}' to the cache '{s}': {t}",
|
||||
.{ entry.dest, entry.cache.path, err },
|
||||
);
|
||||
} else {
|
||||
verbosePrint(
|
||||
opts,
|
||||
stderr,
|
||||
"cache: skipped {s}: {t}",
|
||||
.{ entry.dest, err },
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user