Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle errors sent by the backend? #193

Open
Leni-Vienne opened this issue Feb 19, 2025 · 0 comments
Open

How to handle errors sent by the backend? #193

Leni-Vienne opened this issue Feb 19, 2025 · 0 comments

Comments

@Leni-Vienne
Copy link

Hello, I'm starting to use Nuxt alongside TRPC but I'm struggling to understand how to handle errors that the backend sends to the front end. The useQuery() and useMutation() functions seem very conveniant but with useQuery I get a warning in the browser :
[nuxt] [useAsyncData] Component is already mounted, please use $fetch instead

and with useMutation() a typescript error in VSCode :
Object literal may only specify known properties, and 'my_variable' does not exist in type 'Omit<AsyncDataOptions<void, void, KeysOf<void>, null>, "lazy"> & { trpc?: TRPCRequestOptions | undefined; }'.ts-plugin(2353).

So if I can only use query() and mutate(), how can I easily handle errors? thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant