Huggingface.js 文档

类: HubApiError

Hugging Face's logo
加入 Hugging Face 社区

并获取增强的文档体验

开始使用

类: HubApiError

当调用 Hugging Face Hub 的 API 失败时抛出的错误。

继承关系

  • Error

    HubApiError

构造函数

constructor

new HubApiError(url, statusCode, requestId?, message?): HubApiError

参数

名称 类型
url string
statusCode number
requestId? string
message? string

返回值

HubApiError

覆盖

Error.constructor

定义于

hub/src/error.ts:40

属性

cause

可选 cause: unknown

继承自

Error.cause

定义于

doc-internal/node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es2022.error.d.ts:24


data

可选 data: JsonObject

定义于

hub/src/error.ts:38


message

message: string

继承自

Error.message

定义于

doc-internal/node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es5.d.ts:1077


name

name: string

继承自

Error.name

定义于

doc-internal/node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es5.d.ts:1076


requestId

Optional requestId: string

定义于

hub/src/error.ts:37


堆栈

Optional stack: string

继承自

Error.stack

定义于

doc-internal/node_modules/.pnpm/typescript@5.4.2/node_modules/typescript/lib/lib.es5.d.ts:1078


statusCode

statusCode: number

定义于

hub/src/error.ts:35


url

url: string

定义于

hub/src/error.ts:36


prepareStackTrace

Static Optional prepareStackTrace: (err: Error, stackTraces: CallSite[]) => any

可选的覆盖以格式化堆栈跟踪

参见

https://v8.node.org.cn/docs/stack-trace-api#customizing-stack-traces

类型声明

▸ (err, stackTraces): any

参数
名称 类型
err Error
stackTraces CallSite[]
返回值

any

继承自

Error.prepareStackTrace

定义于

hub/node_modules/.pnpm/@types+node@20.11.28/node_modules/@types/node/globals.d.ts:28


stackTraceLimit

Static stackTraceLimit: number

继承自

Error.stackTraceLimit

定义于

hub/node_modules/.pnpm/@types+node@20.11.28/node_modules/@types/node/globals.d.ts:30

方法

captureStackTrace

captureStackTrace(targetObject, constructorOpt?): void

在目标对象上创建 .stack 属性

参数

名称 类型
targetObject object
constructorOpt? Function

返回值

void

继承自

Error.captureStackTrace

定义于

hub/node_modules/.pnpm/@types+node@20.11.28/node_modules/@types/node/globals.d.ts:21

< > 在 GitHub 上更新