Open InfoSec812 opened 3 years ago
@InfoSec812 this is definitely something we should improve. Currently, we started to use HttpException
as the “default” exception type in vert.x web to signal exceptions with an associated HTTP status code. It seems we didn't consider the full stack.
If we could make these 2 exceptions, a hierarchy, then we could solve the problem by itself.
Given that service exception lives in vertx-service-proxy
and http exception in vertx-web
we may need to propose moving http exception to vertx-web-common
and make service exception extend it? (this would avoid having a larger dependency tree pulled for service proxies).
Ideally, I guess if we could move HttpException
to vertx-core
would be even cleaner, as it would avoid touching dependencies at all.
/cc @vietj
is there a way to have service-proxy ship directly the code using ServiceException
?
it looks like a bug to me do you have a simple reproducer ?
@vietj Yes, here is a reduced and simplified reproducer.
Describe the feature
Modify the Web API Service code generators to support responses with custom exceptions. Right now, in an implementation of the service interface, if I call the provided handler with a custom exception the information in the message is never surfaced.
Example:
The resulting REST response created by
ErrorHandler
does not retain that custom error message. It appears to get swallowed byServiceException
and instead the resulting error just says:In my mind, it would make sense to somehow be able to create a failed request where the status code and error message could be specified in the implementation method.
Use cases
This would make it easier to integrate with OpenAPI Generator so that I can generate stubs which have this sort of placeholder implementation
Contribution
I am willing to look at it myself, but would need some assistance in getting familiar with the relevant components.