Skip to content

Commit b0c26d5

Browse files
authored
fix(nitro): make evlogErrorHandler compatible with TanStack Start middleware API (#220)
1 parent 51d3b86 commit b0c26d5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"evlog": patch
3+
---
4+
5+
fix(nitro): make `evlogErrorHandler` compatible with TanStack Start's `createMiddleware().server()` API
6+
7+
`evlogErrorHandler` now accepts both `(next)` and `({ next })` signatures, so `createMiddleware().server(evlogErrorHandler)` works directly without a wrapper in all TanStack Start versions.

packages/evlog/src/nitro-v3/middleware.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import { serializeEvlogErrorResponse } from '../nitro'
2323
* ```
2424
*/
2525

26-
export async function evlogErrorHandler<T>(next: (...args: any[]) => Promise<T>): Promise<T> {
26+
export async function evlogErrorHandler<T>(nextOrOptions: ((...args: any[]) => Promise<T>) | { next: (...args: any[]) => Promise<T> }): Promise<T> {
27+
const next = typeof nextOrOptions === 'function' ? nextOrOptions : nextOrOptions.next
2728
try {
2829
return await next()
2930
} catch (error: unknown) {

0 commit comments

Comments
 (0)