TS TypeSafe 文档中文版 原文 ↗

类:RateLimitError

HTTP 429:超出了速率限制。

继承自

构造函数

构造函数

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

参数

status

number

body

unknown

headers

Headers

message?

string

返回值

RateLimitError

继承自

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


retryAfterMs

typescript
readonly retryAfterMs: number | undefined;
 

服务器给出的重试延迟,单位为毫秒;在缺失或无效时为 undefined。


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