Pass context to exception handler
Hey, is there a way to pass some context about request to the exception handler via Hono context?
.set and access it in the using // Example route
app.get('/', async (c) => {
// ....computing the context...
const context = {
extensionID: params.extension_id,
fingerprint: params.fingerprint,
plan: account.plan(),
accountID: account.id(),
extensionVersion: params.extension_version,
currentPhoto: account.totalUsage() + 1,
clerkID: clerkID,
aiMode: params.ai_mode,
solveMode: params.solve_mode,
language: params.language,
joinedAt: account.createdAt(),
};
// ...some exception happening..
});
// Custom error handler
app.onError((err, c) => {
// I want to have access to it in here via "c"
});onError.get