TanStackT
TanStack3y ago
16 replies
awake-maroon

Thrown Errors within a query onSuccess fail silently

I have been working with https://github.com/OrJDev/solid-trpc. More specifically the SSR branch that makes use of @adeora/solid-query

An issue I am running into or seeing is that the
onSuccess
will silently fail if you happened to throw something inside:

const restaurantQueryRes = trpc.api.restaurant.getRestaurants.useQuery(undefined, () => {
        return {
            onSuccess: (data: RestaurantName[]) => {
                throw new Error("test"); // Fails silent
            }
        }
    });

Is this to be expected? One could put a try catch inside the
onSuccess
. However the lack of logging of the throw or just in general at least doesn't feel correct?
Was this page helpful?