Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/21644#discussion_r198548363
--- Diff:
core/src/main/scala/org/apache/spark/status/api/v1/ApiRootResource.scala ---
@@ -148,38 +148,21 @@ private[v1] trait BaseAppResource extends
ApiRequestContext {
}
private[v1] class ForbiddenException(msg: String) extends
WebApplicationException(
- Response.status(Response.Status.FORBIDDEN).entity(msg).build())
+ UIUtils.buildErrorResponse(Response.Status.FORBIDDEN, msg))
private[v1] class NotFoundException(msg: String) extends
WebApplicationException(
- new NoSuchElementException(msg),
- Response
- .status(Response.Status.NOT_FOUND)
- .entity(ErrorWrapper(msg))
- .build()
-)
+ new NoSuchElementException(msg),
+ UIUtils.buildErrorResponse(Response.Status.NOT_FOUND, msg))
private[v1] class ServiceUnavailable(msg: String) extends
WebApplicationException(
- new ServiceUnavailableException(msg),
- Response
- .status(Response.Status.SERVICE_UNAVAILABLE)
- .entity(ErrorWrapper(msg))
- .build()
-)
+ new ServiceUnavailableException(msg),
--- End diff --
Hmm... none of this is your fault, but it seems these exceptions are not
needed anymore. jax-rs 2.1 has exceptions for all these and they could just
replace these wrappers.
e.g. if you just throw `ServiceUnavailableException` directly instead of
this wrapper, the result would be the same.
You can find all exceptions at:
https://jax-rs.github.io/apidocs/2.1/javax/ws/rs/package-summary.html
I think it's better to clean this up instead of adding another helper API.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]