Skip to content

Commit

Permalink
feat(zero-cache): log reason when shutting down because of another ze…
Browse files Browse the repository at this point in the history
…ro-cache (#3468)
  • Loading branch information
darkgnotic authored Jan 3, 2025
1 parent 329aad8 commit 25bca15
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ function translateError(e: unknown): Error {
return new Error(String(e));
}
if (e instanceof DatabaseError && e.code === PG_ADMIN_SHUTDOWN) {
return new AbortError(e.message, {cause: e});
return new ShutdownSignal(e);
}
return e;
}
Expand All @@ -905,3 +905,13 @@ export class UnsupportedSchemaChangeError extends Error {
);
}
}

class ShutdownSignal extends AbortError {
readonly name = 'ShutdownSignal';

constructor(cause: unknown) {
super('shutdown signal received (e.g. another zero-cache starting up)', {
cause,
});
}
}

0 comments on commit 25bca15

Please sign in to comment.