From 513f4cc15d559bad88dd13e1033fc03ca7f96d42 Mon Sep 17 00:00:00 2001 From: Konstantin Wohlwend Date: Sun, 1 Dec 2024 01:51:18 -0800 Subject: [PATCH] Better error messages --- .../api/v1/integrations/neon/oauth/idp/[[...route]]/idp.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/backend/src/app/api/v1/integrations/neon/oauth/idp/[[...route]]/idp.ts b/apps/backend/src/app/api/v1/integrations/neon/oauth/idp/[[...route]]/idp.ts index 5e45ef045..71e18c0e6 100644 --- a/apps/backend/src/app/api/v1/integrations/neon/oauth/idp/[[...route]]/idp.ts +++ b/apps/backend/src/app/api/v1/integrations/neon/oauth/idp/[[...route]]/idp.ts @@ -48,9 +48,9 @@ function createAdapter(options: { } async upsert(id: string, payload: AdapterPayload, expiresInSeconds: number): Promise { - if (expiresInSeconds < 0) throw new StackAssertionError(`expiresInSeconds must be non-negative, got ${expiresInSeconds}`); - if (expiresInSeconds > 60 * 60 * 24 * 365 * 100) throw new StackAssertionError(`expiresInSeconds must be less than 100 years, got ${expiresInSeconds}`); - if (!Number.isFinite(expiresInSeconds)) throw new StackAssertionError(`expiresInSeconds must be a finite number, got ${expiresInSeconds}`); + if (expiresInSeconds < 0) throw new StackAssertionError(`expiresInSeconds must be non-negative, got ${expiresInSeconds}`, { expiresInSeconds, model: this.model, id, payload }); + if (expiresInSeconds > 60 * 60 * 24 * 365 * 100) throw new StackAssertionError(`expiresInSeconds must be less than 100 years, got ${expiresInSeconds}`, { expiresInSeconds, model: this.model, id, payload }); + if (!Number.isFinite(expiresInSeconds)) throw new StackAssertionError(`expiresInSeconds must be a finite number, got ${expiresInSeconds}`, { expiresInSeconds, model: this.model, id, payload }); await niceUpdate(this.model, id, () => ({ payload, expiresAt: new Date(Date.now() + expiresInSeconds * 1000) })); }