类 ModelException

所有已实现的接口:
Serializable

public class ModelException extends RuntimeException
Exception thrown when model operations fail. This exception provides a unified way to handle errors from different model providers.
另请参阅:
  • 构造器详细资料

    • ModelException

      public ModelException(String message)
      Creates a ModelException with a message.

      Use this constructor for general model errors when specific model/provider information is not available or relevant.

      参数:
      message - the error message
    • ModelException

      public ModelException(String message, Throwable cause)
      Creates a ModelException with a message and cause.

      Use this constructor when wrapping another exception that caused the model error.

      参数:
      message - the error message
      cause - the underlying cause of the exception
    • ModelException

      public ModelException(String message, String modelName, String provider)
      Creates a ModelException with message and model information.

      Use this constructor when the error is specific to a particular model and provider, allowing for more targeted error handling and debugging.

      参数:
      message - the error message
      modelName - the name of the model that caused the error
      provider - the provider of the model (e.g., "openai", "dashscope")
    • ModelException

      public ModelException(String message, Throwable cause, String modelName, String provider)
      Creates a ModelException with message, cause, and model information.

      Use this constructor when wrapping another exception that caused the model error, and the error is specific to a particular model and provider.

      参数:
      message - the error message
      cause - the underlying cause of the exception
      modelName - the name of the model that caused the error
      provider - the provider of the model (e.g., "openai", "dashscope")
  • 方法详细资料

    • getModelName

      public String getModelName()
      Gets the name of the model that caused the error.
      返回:
      the model name, or null if not set
    • getProvider

      public String getProvider()
      Gets the provider of the model that caused the error.
      返回:
      the provider name, or null if not set
    • toString

      public String toString()
      覆盖:
      toString 在类中 Throwable