Skip to content

Commit a8129c1

Browse files
refactor(desktop): name the jar a Safari read failed on
Matches the Chromium and Firefox readers: the failure carries which jar it was for, so a Full Disk Access refusal is traceable rather than anonymous. Optional because the parser raises before a path is in hand. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 11b89fd commit a8129c1

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

apps/desktop/src/preview/BrowserImport/SafariCookies.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,19 @@ export class SafariCookieReadError extends Schema.TaggedErrorClass<SafariCookieR
4343
"SafariCookieReadError",
4444
{
4545
reason: SafariCookieReadFailure,
46+
/**
47+
* Which jar the read was for. The parser raises this before a path is in
48+
* hand, so it is optional rather than required.
49+
*/
50+
cookieDatabasePath: Schema.optional(Schema.String),
4651
/** Kept for the log; never surfaced to the user. */
4752
cause: Schema.optional(Schema.Defect()),
4853
},
4954
) {
5055
override get message(): string {
51-
return `Could not read Safari cookies: ${this.reason}.`;
56+
return this.cookieDatabasePath === undefined
57+
? `Could not read Safari cookies: ${this.reason}.`
58+
: `Could not read Safari cookies at ${this.cookieDatabasePath}: ${this.reason}.`;
5259
}
5360
}
5461

@@ -163,6 +170,7 @@ export const readSafariCookies = Effect.fn("SafariCookies.readSafariCookies")(fu
163170
const denied = cause.reason._tag === "PermissionDenied";
164171
return new SafariCookieReadError({
165172
reason: denied ? "needsFullDiskAccess" : "readFailed",
173+
cookieDatabasePath: cookiePath,
166174
cause,
167175
});
168176
}),
@@ -174,6 +182,10 @@ export const readSafariCookies = Effect.fn("SafariCookies.readSafariCookies")(fu
174182
catch: (cause) =>
175183
isSafariCookieReadError(cause)
176184
? cause
177-
: new SafariCookieReadError({ reason: "readFailed", cause }),
185+
: new SafariCookieReadError({
186+
reason: "readFailed",
187+
cookieDatabasePath: cookiePath,
188+
cause,
189+
}),
178190
});
179191
});

0 commit comments

Comments
 (0)