异常

此页面包含 BentoML 抛出的异常列表。

class bentoml.exceptions.BentoMLException(message: str, *, error_code: HTTPStatus | None = None)[source]

所有 BentoML 错误的基类。每个自定义异常都应该派生自此类。

class bentoml.exceptions.RemoteException(message: str, payload: BentoMLException | None = None)[source]

用于包装来自远程服务器异常的特殊异常

class bentoml.exceptions.InvalidArgument(message: str, *, error_code: HTTPStatus | None = None)[source]

当 BentoML 从 CLI 参数、HTTP 请求或 Python API 函数参数接收到意外/无效参数时抛出。

class bentoml.exceptions.MissingDependencyException(message: str, *, error_code: HTTPStatus | None = None)[source]

当 BentoML 组件加载所需依赖项失败时抛出。

一些 BentoML 组件具有可选依赖项,可以作为扩展安装。

例如,当使用 JSON IODescriptor 时,如果用户希望使用 pydantic 进行验证,则 pydantic 被视为可选功能。即使未安装 pydantic,BentoML 仍可正常工作。

class bentoml.exceptions.InternalServerError(message: str, *, error_code: HTTPStatus | None = None)[source]

当 BentoML 从 CLI 参数、HTTP 请求或 Python API 函数参数接收到有效参数,但在处理时出现内部问题时抛出。

  • BentoML 开发者注意:仅当用户代码(Runner 或 Service)中发生异常并希望将其暴露给用户时抛出此异常。

in the users’ code (runner or service) and want to surface it to the user.

class bentoml.exceptions.NotFound(message: str, *, error_code: HTTPStatus | None = None)[source]

未找到指定资源或名称时抛出

class bentoml.exceptions.BadInput(message: str, *, error_code: HTTPStatus | None = None)[source]

API 服务器接收到错误输入请求时抛出

class bentoml.exceptions.ServiceUnavailable(message: str, *, error_code: HTTPStatus | None = None)[source]

当传入请求超出服务器容量时抛出

class bentoml.exceptions.BentoMLConfigException(message: str, *, error_code: HTTPStatus | None = None)[source]

当 BentoML 配置错误或缺少必需配置时抛出

class bentoml.exceptions.ImportServiceError(message: str, *, error_code: HTTPStatus | None = None)[source]

BentoML 导入用户服务文件失败时抛出。