bug: no way to specify error meta
See original GitHub issueProvide environment information
System: OS: macOS 12.4 CPU: (8) arm64 Apple M1 Pro Memory: 97.84 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.7.0 - /opt/homebrew/bin/node npm: 8.15.0 - /opt/homebrew/bin/npm Browsers: Chrome: 105.0.5195.102 Firefox: 104.0.1 Safari: 15.5
Describe the bug
We want to be able to get custom error meta objects. At the moment it doesn’t seem possible.
// Invalid phone number
if (body.status === '3') {
throw new TRPCError({
code: 'BAD_REQUEST',
message: 'Bad phone number',
cause: 'invalid-number',
});
}
We need to read ‘cause’ as message is a user friendly coding error. It would also be nice to pass meta JSON objects; sometimes error messages need to contain more data.
There seems to be no way to pass though that data.
{ [TRPCClientError: Your request is incomplete and missing the mandatory parameter: number] [cause]: undefined, originalError: undefined, shape: {
message: 'Your request is incomplete and missing the mandatory parameter: number',
code: -32600,
data: {
code: 'BAD_REQUEST',
httpStatus: 400,
stack: ''
path: 'user.enter-phone-number'
}
}, data: {
code: 'BAD_REQUEST',
httpStatus: 400,
stack: ''
path: 'user.enter-phone-number'
}, isDone: false, name: 'TRPCClientError' }
To reproduce
^^
Additional information
No response
👨👧👦 Contributing
- 🙋♂️ Yes, I’d be down to file a PR fixing this bug!
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
How to troubleshoot Meta Pixel error and warning messages ...
This is a list of Meta Pixel errors and warnings you might see in the Diagnostics tab in Meta Events Manager. You can...
Read more >BUG/RTK Query/Meta is not showing up on throwing error ...
The queryFn when throwing an error does not include the meta payload logUserIn: ... Is their any way to set a custom type...
Read more >[meta] meta bug - show error pages instead of dialogs for ...
No error dialog is shown, which is good. It appears that IFRAME elements are the culprit. When these specify a URI that is...
Read more >How to Fix Meta Pixel (Facebook Pixel) Errors and Test Events
On your Meta Business Suite homepage, go to All tools (indicated by the little hamburger menu) and select Events Manager. Now, go to...
Read more >How to Fix Meta Facebook Pixel Errors and Test Your Events
The Meta Facebook Pixel is a piece of code that you can install on your website to track the different kinds of actions...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This should also work
This issue has been locked because it had no new activity for 14 days. If you are running into a similar issue, please create a new issue. Thank you.