程序包 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
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明private final ProblemDetailprivate final HttpHeadersprivate static final longprivate final HttpStatusCode -
构造器概要
构造器构造器说明ErrorResponseException(HttpStatusCode status) Constructor with aHttpStatusCode.ErrorResponseException(HttpStatusCode status, ProblemDetail body, Throwable cause) Constructor with a givenProblemDetailinstance, possibly a subclass ofProblemDetailwith extended fields.ErrorResponseException(HttpStatusCode status, Throwable cause) Constructor with aHttpStatusCodeand an optional cause. -
方法概要
修饰符和类型方法说明final ProblemDetailgetBody()Return the body for the response.Return headers to use for the response.Return the HTTP status code to use for the response.voidSet thedetailfield of the response body.voidsetInstance(URI instance) Set theinstancefield of the response body.voidSet thetitlefield of the response body.voidSet thetypefield of the response body.从类继承的方法 cn.taketoday.core.NestedRuntimeException
contains, getMostSpecificCause, getNestedMessage, getRootCause
-
字段详细资料
-
serialVersionUID
private static final long serialVersionUID- 另请参阅:
-
status
-
headers
-
body
-
-
构造器详细资料
-
ErrorResponseException
Constructor with aHttpStatusCode. -
ErrorResponseException
Constructor with aHttpStatusCodeand an optional cause. -
ErrorResponseException
Constructor with a givenProblemDetailinstance, possibly a subclass ofProblemDetailwith extended fields.
-
-
方法详细资料
-
getStatusCode
从接口复制的说明:ErrorResponseReturn the HTTP status code to use for the response.- 指定者:
getStatusCode在接口中ErrorResponse- 指定者:
getStatusCode在接口中HttpStatusCodeProvider
-
getHeaders
从接口复制的说明:ErrorResponseReturn headers to use for the response.- 指定者:
getHeaders在接口中ErrorResponse
-
setType
Set thetypefield of the response body.- 参数:
type- the problem type
-
setTitle
Set thetitlefield of the response body.- 参数:
title- the problem title
-
setDetail
Set thedetailfield of the response body.- 参数:
detail- the problem detail
-
setInstance
Set theinstancefield of the response body.- 参数:
instance- the problem instance
-
getBody
Return the body for the response. To customize the body content, use:By default, the status field of
ProblemDetailis 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 aProblemDetailis returned from an@ExceptionHandlermethod.- 指定者:
getBody在接口中ErrorResponse
-
getMessage
- 覆盖:
getMessage在类中Throwable
-