Closed juliusmarminge closed 3 months ago
This issue has been automatically marked as stale because it has not had any activity for 10 days. It will be closed in 5 days if no further activity occurs.
This issue has been closed because it has not had any activity for 5 days since being marked as stale.
Describe the feature you'd like to request
Right now we convert all possible errors to a single
UploadThing
class. This is a) tedious to maintain as you need to think of ways to "rephrase" the base error to the more generic UploadThing one and b) hard to check against as a user since there's no good way to differentiate between errors in for example the error formatter, or client sideonUploadError
.Sure there are some different code's but similar to http codes they're quite general and meant to map between (like BAD_REQUEST -> HTTP Status 400 for example).
Describe the solution you'd like to see
Should we export more error classes? Right now we have quite many (see https://github.com/pingdotgg/uploadthing/blob/main/packages/shared/src/tagged-errors.ts). This would allow users to do
instanceof
a certain error and decide whether it should get rethrown or converted to a more generic one if they don't want to expose the information to the client:It will still be a balance on us maintainers to decide what to put as
message
and what to put asreason
(naming tbd), but at least we could do that on the base error class once and not have to think about converting it later:Additional information
No response
👨👧👦 Contributing