Skip to content

Commit

Permalink
fix: add logs and catch error (#675)
Browse files Browse the repository at this point in the history
  • Loading branch information
chronark authored Dec 12, 2023
1 parent 094af4b commit d70df54
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/api/src/pkg/keys/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,15 @@ export class KeyService {
/**
* Expiration
*/
if (data.key.expires !== null && data.key.expires.getTime() < Date.now()) {
try {
if (data.key.expires && data.key.expires.getTime() < Date.now()) {
return result.success({ valid: false, code: "NOT_FOUND" });
}
} catch (e) {
this.logger.error("Failed to check key expiration", {
error: (e as Error).message,
key: data.key.id,
});
return result.success({ valid: false, code: "NOT_FOUND" });
}

Expand Down

0 comments on commit d70df54

Please sign in to comment.