From 0adb6f5eba8c73c253fd4ba79e626ebd9e74e547 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 10 Sep 2023 19:43:07 -0500 Subject: [PATCH] Add messages to HTTPException's --- src/middleware/auth19.ts | 2 +- src/middleware/auth98.ts | 2 +- src/sign.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/middleware/auth19.ts b/src/middleware/auth19.ts index f92f678..fec79ad 100644 --- a/src/middleware/auth19.ts +++ b/src/middleware/auth19.ts @@ -38,7 +38,7 @@ const auth19: AppMiddleware = async (c, next) => { /** Throw a 401 if the pubkey isn't set. */ const requirePubkey: AppMiddleware = async (c, next) => { if (!c.get('pubkey')) { - throw new HTTPException(401); + throw new HTTPException(401, { message: 'No pubkey provided' }); } await next(); diff --git a/src/middleware/auth98.ts b/src/middleware/auth98.ts index 8a2272b..20787fe 100644 --- a/src/middleware/auth98.ts +++ b/src/middleware/auth98.ts @@ -81,7 +81,7 @@ function withProof( c.set('proof', proof); await handler(c, proof, next); } else { - throw new HTTPException(401); + throw new HTTPException(401, { message: 'No proof' }); } }; } diff --git a/src/sign.ts b/src/sign.ts index a97478a..14c192f 100644 --- a/src/sign.ts +++ b/src/sign.ts @@ -36,7 +36,7 @@ async function signNostrConnect(event: EventTemplate< const pubkey = c.get('pubkey'); if (!pubkey) { - throw new HTTPException(401); + throw new HTTPException(401, { message: 'Missing pubkey' }); } const messageId = crypto.randomUUID();