ModelException
public class ModelException extends RuntimeException
源码Source
io/agentscope/core/model/ModelException.java:22–118模型异常,表示执行过程中的错误。位于 io.agentscope.core.model 包,继承自 RuntimeException。核心成员包括 getModelName、getProvider、toString、ModelException。
Exception thrown when model operations fail. This exception provides a unified way to handle errors from different model providers.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public ModelException(String message) | 创建ModelException 使用消息。 Creates a ModelException with a message. |
public ModelException(String message, Throwable cause) | 初始化 `ModelException` 实例。 Creates a ModelException with a message and cause. |
public ModelException(String message, String modelName, String provider) | 初始化 `ModelException` 实例。 Creates a ModelException with message and model information. |
public ModelException(String message, Throwable cause, String modelName, String provider) | 初始化 `ModelException` 实例。 Creates a ModelException with message, cause, and model information. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getModelName() | 获取模型名称。 Gets the name of the model that caused the error. |
public String getProvider() | 获取提供者。 Gets the provider of the model that caused the error. |
public String toString() | 返回 `toString` 结果。 Returns the to string. |
构造器详情Constructor Detail
ModelException
public ModelException(String message)
创建ModelException 使用消息。
Creates a ModelException with a message.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
message | String | 错误消息。the error message |
源码Source
io/agentscope/core/model/ModelException.java:35–39ModelException
public ModelException(String message, Throwable cause)
初始化 ModelException 实例。
Creates a ModelException with a message and cause.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
message | String | 错误消息。the error message |
cause | Throwable | cause(类型 `Throwable`)。the underlying cause of the exception |
源码Source
io/agentscope/core/model/ModelException.java:49–53ModelException
public ModelException(String message, String modelName, String provider)
初始化 ModelException 实例。
Creates a ModelException with message and model information.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
message | String | 错误消息。the error message |
modelName | String | 模型名称(类型 `String`)。the name of the model that caused the error |
provider | String | 提供者(类型 `String`)。the provider of the model (e.g., "openai", "dashscope") |
源码Source
io/agentscope/core/model/ModelException.java:65–69ModelException
public ModelException(String message, Throwable cause, String modelName, String provider)
初始化 ModelException 实例。
Creates a ModelException with message, cause, and model information.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
message | String | 错误消息。the error message |
cause | Throwable | cause(类型 `Throwable`)。the underlying cause of the exception |
modelName | String | 模型名称(类型 `String`)。the name of the model that caused the error |
provider | String | 提供者(类型 `String`)。the provider of the model (e.g., "openai", "dashscope") |
源码Source
io/agentscope/core/model/ModelException.java:82–86方法详情Method Detail
getModelName
public String getModelName()
获取模型名称。
Gets the name of the model that caused the error.
String返回字符串结果。the model name, or null if not set
源码Source
io/agentscope/core/model/ModelException.java:93–95getProvider
public String getProvider()
获取提供者。
Gets the provider of the model that caused the error.
String返回字符串结果。the provider name, or null if not set
源码Source
io/agentscope/core/model/ModelException.java:102–104toString
public String toString()
返回 toString 结果。
Returns the to string.
String返回字符串结果。Returns a string.
源码Source
io/agentscope/core/model/ModelException.java:106–117