mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-28 10:50:35 +01:00
fix publish issue
This commit is contained in:
15
package/recipes/error-handling.md
Normal file
15
package/recipes/error-handling.md
Normal file
@@ -0,0 +1,15 @@
|
||||
## Handling errors
|
||||
|
||||
All errors that occur in a procedure go through the `onError` method before being sent to the client. Here you can handle or change errors.
|
||||
|
||||
```ts
|
||||
// ~/server/trpc/index.ts
|
||||
import * as trpc from '@trpc/server'
|
||||
|
||||
export function onError({ error, type, path, input, ctx, req }) {
|
||||
console.error('Error:', error)
|
||||
if (error.code === 'INTERNAL_SERVER_ERROR') {
|
||||
// send to bug reporting
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user