Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21644#discussion_r198561212
  
    --- 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 --
    
    I think it's ok to leave (almost) as is. It avoid duplicating the status 
code in every call, which would be annoying.
    
    But we can remove the "cause" exceptions from all these wrappers since 
they're redundant.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to