Skip to content

Commit fd76cc0

Browse files
refactor(desktop): name the database a Firefox read failed on
Firefox keeps one cookie database per profile, so a failure carrying only a reason cannot be traced back to the profile that produced it. The path is now a structural attribute, matching `ChromiumCookieReadError`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 7a78146 commit fd76cc0

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,18 @@ export class FirefoxCookieReadError extends Schema.TaggedErrorClass<FirefoxCooki
3434
"FirefoxCookieReadError",
3535
{
3636
reason: FirefoxCookieReadReason,
37+
/**
38+
* Which database the read was for. Firefox keeps one per profile, so
39+
* without it a failure cannot be traced back to the profile that caused
40+
* it.
41+
*/
42+
cookieDatabasePath: Schema.String,
3743
/** Kept for the log; never surfaced to the user. */
3844
cause: Schema.optional(Schema.Defect()),
3945
},
4046
) {
4147
override get message(): string {
42-
return `Could not read Firefox cookies: ${this.reason}.`;
48+
return `Could not read Firefox cookies at ${this.cookieDatabasePath}: ${this.reason}.`;
4349
}
4450
}
4551

@@ -67,7 +73,9 @@ export const readFirefoxCookies = Effect.fn("FirefoxCookies.readFirefoxCookies")
6773
cookieDatabasePath: string,
6874
) {
6975
const snapshotPath = yield* snapshotCookieDatabase(cookieDatabasePath).pipe(
70-
Effect.mapError((cause) => new FirefoxCookieReadError({ reason: "readFailed", cause })),
76+
Effect.mapError(
77+
(cause) => new FirefoxCookieReadError({ reason: "readFailed", cookieDatabasePath, cause }),
78+
),
7179
);
7280

7381
const rows = yield* Effect.gen(function* () {
@@ -85,7 +93,9 @@ export const readFirefoxCookies = Effect.fn("FirefoxCookies.readFirefoxCookies")
8593
return yield* decodeCookieRows(raw);
8694
}).pipe(
8795
Effect.provide(NodeSqliteClient.layer({ filename: snapshotPath, readonly: true })),
88-
Effect.mapError((cause) => new FirefoxCookieReadError({ reason: "readFailed", cause })),
96+
Effect.mapError(
97+
(cause) => new FirefoxCookieReadError({ reason: "readFailed", cookieDatabasePath, cause }),
98+
),
8999
);
90100

91101
return rows.map((row) => {

0 commit comments

Comments
 (0)