TS TypeSafe 文档中文版 原文 ↗

类:AuthenticationError

HTTP 401:身份验证失败。

继承自

构造函数

构造函数

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

参数

status

number

body

unknown

headers

Headers

message?

string

返回

AuthenticationError

继承自

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