T
tRPC

❓-help

Modify mutation error messages?

JFJack Fischer12/21/2023
We occasionally get timeouts from cloudfront which gives the user an error about how the cloudfront HTML error page isn't valid JSON, instead of what would make sense to the user, which is that the request timed out. Is there a callback or anything else anywhere we could use to intercede on error messages?
JFJack Fischer12/21/2023
Ah I think I answered my own question,
trpcNext.createNextApiHandler({
onError: ...
})
trpcNext.createNextApiHandler({
onError: ...
})
Hmm, this actually doesn't seem to let you modify the error, just take some external action with it
Nnlucas12/21/2023
It's interesting that a failed request would try to be parsed at all by the frontend, maybe worth raising a github issue about this with some extra detail

Looking for more? Join the community!