mirror of
https://github.com/aljazceru/ditto.git
synced 2026-02-23 14:06:58 +01:00
Add messages to HTTPException's
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user