Replies: 1 comment 1 reply
-
You can pass trpc/packages/server/src/TRPCError.ts Line 19 in b85b465 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey! I'm curious if trpc has any opinions on, or would like to have opinions on, how to communicate what a client did wrong in a "bad request" scenario. For example, if a client sends an object like
POST /createUser -d "{ username: 'abc', password: 'abc123' }"
, it might be nice to have a "blessed" way to send back some extra information from the server about why the request gets rejected. I could imagine it looking something like:Where
detailsThatAreDefinitelySafeToSendToTheClient
is a deliberately bad name, but basically can give the client some hints about what error to show to the user/send to error reporting services. It could either be typed asunknown
orany
or something, or it could be part of some kind of type config for the router (I know typing errors has been discussed in a few other issues, but it's a nice-to-have for something like this, IMO).Beta Was this translation helpful? Give feedback.
All reactions