Add messages to HTTPException's
This commit is contained in:
parent
75dd2652d2
commit
0adb6f5eba
|
@ -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();
|
||||
|
|
|
@ -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' });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ async function signNostrConnect<K extends number = number>(event: EventTemplate<
|
|||
const pubkey = c.get('pubkey');
|
||||
|
||||
if (!pubkey) {
|
||||
throw new HTTPException(401);
|
||||
throw new HTTPException(401, { message: 'Missing pubkey' });
|
||||
}
|
||||
|
||||
const messageId = crypto.randomUUID();
|
||||
|
|
Loading…
Reference in New Issue