Closed caschbre closed 1 year ago
What do you mean? Like here?
Ah, sorry I wasn't very clear. I was looking at the error handling example provided in the trpc docs.
export default trpcNext.createNextApiHandler({
// ...
onError({ error, type, path, input, ctx, req }) {
console.error('Error:', error);
if (error.code === 'INTERNAL_SERVER_ERROR') {
// send to bug reporting
}
},
});
Ah, I see, you mean handling on the server. I did not expose onError
as a parameter of createTRPCHandle
, but I guess I should.
Will release a new version shortly.
Landed in v3.1.0
.
Look at the bottom of the page here: https://icflorescu.github.io/trpc-sveltekit/handling-errors
Basically you can now provide an onError
function to createTRPCHandle
.
Awesome! Exactly what I was looking for. Thanks!
I was reading through the tRPC Error Handling docs, but wasn't quite sure how to implement that using trpc-sveltekit.
I figured this example project would be a great place for that. :-)