igmtink
What is the best way to handle the error?
I mean if the body don't have a content it will consider as reject? so I tried to use
throw new HTTPException
to reject the promise unlike return c.json({message}, {status: 401})
this has a content even it's error22 replies
What is the best way to handle the error?
I want to know how to handle errors inside the Hono server, so I can get the error within the React Query. What I used to handle the error is this:
return c.json({ message: 'Invalid password' }, { status: 401 })
on the Hono server. The problem is the 'onError' option of React Query doesn't catch it, so I used try-catch to pass the error to 'onError'. Normally, when fetching using the standard Fetch API and there's an error, React Query automatically passes it to 'onError'. But when using RPC, it doesn't pass to 'onError', so I'm not sure if the way I handled the error in my API route is correct. It still returns the error message as data, so I used try-catch."22 replies
How to set "credentials: true" in client side using rpc?
when I'm using standard fetch api with
credentials: 'include'
option, there's no problem at all I got the cookie from server to client, but when using rpc
I can't get the cookie from server to client14 replies