refactor: standardize error handling with toError() helper
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
ea716c1f0e
commit
4d1e592365
@@ -1,4 +1,5 @@
|
||||
import { Hono } from 'hono'
|
||||
import { toError } from '../lib/utils.js'
|
||||
import { db, schema } from '../db/index.js'
|
||||
import { eq, desc } from 'drizzle-orm'
|
||||
import { calculateOdds } from '../engine/odds.js'
|
||||
@@ -104,7 +105,7 @@ betsRouter.post('/place', rateLimit(60_000, 10), async (c) => {
|
||||
potentialPayout: bet.potentialPayout,
|
||||
})
|
||||
} catch (err: unknown) {
|
||||
return c.json({ error: err instanceof Error ? err.message : String(err) }, 400)
|
||||
return c.json({ error: toError(err).message }, 400)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user