TS TypeSafe 文档中文版 原文 ↗

类:UnprocessableEntityError

HTTP 422:请求校验失败。

继承自

构造函数

构造函数

typescript
new UnprocessableEntityError(
   status, 
   body, 
   headers, 
   message?
): UnprocessableEntityError;
 

参数

status

number

body

unknown

headers

Headers

message?

string

返回值

UnprocessableEntityError

继承自

APIError.constructor

属性

body

typescript
readonly body: unknown;
 

解析后的 JSON、响应文本,或者在响应体为空时为 undefined。

继承自

APIError.body


headers

typescript
readonly headers: Headers;
 

HTTP 响应头。

继承自

APIError.headers


requestId

typescript
readonly requestId: string | undefined;
 

来自 x-typesafe-request-id 的请求 ID,在缺失时为 undefined。

继承自

APIError.requestId


status

typescript
readonly status: number;
 

HTTP 响应状态码。

继承自

APIError.status

方法

fromResponse()

typescript
static fromResponse(
   status, 
   body, 
   headers
): APIError;
 

为某个 HTTP 状态码创建对应的错误子类。

参数

status

number

body

unknown

headers

Headers

返回值

APIError

继承自

APIError.fromResponse