AS AgentScopeAPI 手册 / API Reference

DifyApiException

public class DifyApiException extends RuntimeException
源码Source io/agentscope/core/rag/integration/dify/exception/DifyApiException.java:34–158

Dify API 异常,表示执行过程中的错误。位于 io.agentscope.core.rag.integration.dify.exception 包,继承自 RuntimeException。核心成员包括 getStatusCode、getErrorCode、isClientError、isServerError、isRateLimitError、toString。

Exception thrown when Dify API returns an error response.

This exception encapsulates error information from Dify API responses, including HTTP status codes, error codes, and error messages.

Common error scenarios:

  • 400 Bad Request: Invalid parameters or malformed request

  • 401 Unauthorized: Invalid or missing API key

  • 403 Forbidden: Insufficient permissions

  • 404 Not Found: Dataset or document not found

  • 429 Too Many Requests: Rate limit exceeded

  • 500 Internal Server Error: Dify service error

构造器摘要Constructor Summary

构造器Constructor说明Description
public DifyApiException(String message)
创建新的DifyApiException 使用消息。
Creates a new DifyApiException with a message.
public DifyApiException(String message, Throwable cause)
初始化 `DifyApiException` 实例。
Creates a new DifyApiException with a message and cause.
public DifyApiException(int statusCode, String message)
初始化 `DifyApiException` 实例。
Creates a new DifyApiException with HTTP status code.
public DifyApiException(int statusCode, String errorCode, String message)
初始化 `DifyApiException` 实例。
Creates a new DifyApiException with full error details.
public DifyApiException(int statusCode, String errorCode, String message, Throwable cause)
初始化 `DifyApiException` 实例。
Creates a new DifyApiException with full error details and cause.

方法摘要Method Summary

方法Method说明Description
public int getStatusCode()
获取 `getStatusCode`。
Gets the HTTP status code.
public String getErrorCode()
获取 `getErrorCode`。
Gets the Dify error code.
public boolean isClientError()
判断是否客户端错误。
Checks if this is a client error (4xx status code).
public boolean isServerError()
判断是否服务端错误。
Checks if this is a server error (5xx status code).
public boolean isRateLimitError()
判断是否速率限制错误。
Checks if this is a rate limit error (429 status code).
public String toString()
返回 `toString` 结果。
Returns the to string.

构造器详情Constructor Detail

DifyApiException

public DifyApiException(String message)

创建新的DifyApiException 使用消息。

Creates a new DifyApiException with a message.

参数Parameters
名称Name类型Type说明Description
messageString错误消息。the error message
源码Source io/agentscope/core/rag/integration/dify/exception/DifyApiException.java:44–48

DifyApiException

public DifyApiException(String message, Throwable cause)

初始化 DifyApiException 实例。

Creates a new DifyApiException with a message and cause.

参数Parameters
名称Name类型Type说明Description
messageString错误消息。the error message
causeThrowablecause(类型 `Throwable`)。the underlying cause
源码Source io/agentscope/core/rag/integration/dify/exception/DifyApiException.java:56–60

DifyApiException

public DifyApiException(int statusCode, String message)

初始化 DifyApiException 实例。

Creates a new DifyApiException with HTTP status code.

参数Parameters
名称Name类型Type说明Description
statusCodeint状态 Code(类型 `int`)。the HTTP status code
messageString错误消息。the error message
源码Source io/agentscope/core/rag/integration/dify/exception/DifyApiException.java:68–72

DifyApiException

public DifyApiException(int statusCode, String errorCode, String message)

初始化 DifyApiException 实例。

Creates a new DifyApiException with full error details.

参数Parameters
名称Name类型Type说明Description
statusCodeint状态 Code(类型 `int`)。the HTTP status code
errorCodeString错误 Code(类型 `String`)。the Dify error code
messageString错误消息。the error message
源码Source io/agentscope/core/rag/integration/dify/exception/DifyApiException.java:81–85

DifyApiException

public DifyApiException(int statusCode, String errorCode, String message, Throwable cause)

初始化 DifyApiException 实例。

Creates a new DifyApiException with full error details and cause.

参数Parameters
名称Name类型Type说明Description
statusCodeint状态 Code(类型 `int`)。the HTTP status code
errorCodeString错误 Code(类型 `String`)。the Dify error code
messageString错误消息。the error message
causeThrowablecause(类型 `Throwable`)。the underlying cause
源码Source io/agentscope/core/rag/integration/dify/exception/DifyApiException.java:95–99

方法详情Method Detail

getStatusCode

public int getStatusCode()

获取 getStatusCode。

Gets the HTTP status code.

返回Returns int
返回数值结果。the status code, or -1 if not available
源码Source io/agentscope/core/rag/integration/dify/exception/DifyApiException.java:106–108

getErrorCode

public String getErrorCode()

获取 getErrorCode。

Gets the Dify error code.

返回Returns String
返回字符串结果。the error code, or null if not available
源码Source io/agentscope/core/rag/integration/dify/exception/DifyApiException.java:115–117

isClientError

public boolean isClientError()

判断是否客户端错误。

Checks if this is a client error (4xx status code).

返回Returns boolean
返回布尔值,表示判断结果。true if status code is 4xx
源码Source io/agentscope/core/rag/integration/dify/exception/DifyApiException.java:124–126

isServerError

public boolean isServerError()

判断是否服务端错误。

Checks if this is a server error (5xx status code).

返回Returns boolean
返回布尔值,表示判断结果。true if status code is 5xx
源码Source io/agentscope/core/rag/integration/dify/exception/DifyApiException.java:133–135

isRateLimitError

public boolean isRateLimitError()

判断是否速率限制错误。

Checks if this is a rate limit error (429 status code).

返回Returns boolean
返回布尔值,表示判断结果。true if status code is 429
源码Source io/agentscope/core/rag/integration/dify/exception/DifyApiException.java:142–144

toString

public String toString()

返回 toString 结果。

Returns the to string.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/rag/integration/dify/exception/DifyApiException.java:146–157
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.