Bug: Internal Server Error Instead of Proper Error When Nested CRUD Handler Throws Error
Description:
When a CRUD handler A is called inside another CRUD handler B, known errors thrown from A are not properly propagated.
Reproduction:
Trying to change the selected team with a non-existent team ID via Update Current User API.
The correct error was thrown but not propagated correctly.
APIs with this issue:
- Get Current User
- Delete Current User
- Update Current User
Probable Solution:
Add expected errors in allowedErrorTypes while calling CRUD handlers.
Now, allowed errors should propagate properly.
Now we get an appropriate error instead of an internal server error.
Additional Notes:
I would love to work on this issue. Please assign it to me if possible.
@fomalhautb Can I directly add StatusError into allowedErrorTypes instead of adding individual errors? If we add StatusError then we do not need to worry about updating the allowedErrorTypes every time we change/add a error raised inside nested CRUD handlers. Because all known errors are StatusError anyway.