程序包 cn.taketoday.web

类 ErrorResponseException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cn.taketoday.core.NestedRuntimeException
cn.taketoday.web.ErrorResponseException
所有已实现的接口:
HttpStatusCodeProvider, ErrorResponse, Serializable
直接已知子类:
ResponseStatusException

public class ErrorResponseException extends cn.taketoday.core.NestedRuntimeException implements ErrorResponse
RuntimeException that implements ErrorResponse to expose an HTTP status, response headers, and a body formatted as an RFC 7807 ProblemDetail.

The exception can be used as is, or it can be extended as a more specific exception that populates the type or detail fields, or potentially adds other non-standard properties.

从以下版本开始:
4.0 2022/3/2 13:35
作者:
Rossen Stoyanchev, Harry Yang
另请参阅:
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • getStatusCode

      public HttpStatusCode getStatusCode()
      从接口复制的说明: ErrorResponse
      Return the HTTP status code to use for the response.
      指定者:
      getStatusCode 在接口中 ErrorResponse
      指定者:
      getStatusCode 在接口中 HttpStatusCodeProvider
    • getHeaders

      public HttpHeaders getHeaders()
      从接口复制的说明: ErrorResponse
      Return headers to use for the response.
      指定者:
      getHeaders 在接口中 ErrorResponse
    • setType

      public void setType(URI type)
      Set the type field of the response body.
      参数:
      type - the problem type
    • setTitle

      public void setTitle(@Nullable String title)
      Set the title field of the response body.
      参数:
      title - the problem title
    • setDetail

      public void setDetail(@Nullable String detail)
      Set the detail field of the response body.
      参数:
      detail - the problem detail
    • setInstance

      public void setInstance(@Nullable URI instance)
      Set the instance field of the response body.
      参数:
      instance - the problem instance
    • getBody

      public final ProblemDetail getBody()
      Return the body for the response. To customize the body content, use:

      By default, the status field of ProblemDetail is initialized from the status provided to the constructor, which in turn may also initialize the title field from the status reason phrase, if the status is well-known. The instance field, if not set, is initialized from the request path when a ProblemDetail is returned from an @ExceptionHandler method.

      指定者:
      getBody 在接口中 ErrorResponse
    • getMessage

      public String getMessage()
      覆盖:
      getMessage 在类中 Throwable