Pārlūkot izejas kodu

fix(core/errors): change base class of custom exceptions to ValueError (#11955)

Signed-off-by: -LAN- <laipz8200@outlook.com>
tags/0.14.2
-LAN- pirms 10 mēnešiem
vecāks
revīzija
5db8addcc6
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam
1 mainītis faili ar 6 papildinājumiem un 6 dzēšanām
  1. 6
    6
      api/core/errors/error.py

+ 6
- 6
api/core/errors/error.py Parādīt failu

from typing import Optional from typing import Optional




class LLMError(Exception):
class LLMError(ValueError):
"""Base class for all LLM exceptions.""" """Base class for all LLM exceptions."""


description: Optional[str] = None description: Optional[str] = None
description = "Bad Request" description = "Bad Request"




class ProviderTokenNotInitError(Exception):
class ProviderTokenNotInitError(ValueError):
""" """
Custom exception raised when the provider token is not initialized. Custom exception raised when the provider token is not initialized.
""" """
self.description = args[0] if args else self.description self.description = args[0] if args else self.description




class QuotaExceededError(Exception):
class QuotaExceededError(ValueError):
""" """
Custom exception raised when the quota for a provider has been exceeded. Custom exception raised when the quota for a provider has been exceeded.
""" """
description = "Quota Exceeded" description = "Quota Exceeded"




class AppInvokeQuotaExceededError(Exception):
class AppInvokeQuotaExceededError(ValueError):
""" """
Custom exception raised when the quota for an app has been exceeded. Custom exception raised when the quota for an app has been exceeded.
""" """
description = "App Invoke Quota Exceeded" description = "App Invoke Quota Exceeded"




class ModelCurrentlyNotSupportError(Exception):
class ModelCurrentlyNotSupportError(ValueError):
""" """
Custom exception raised when the model not support Custom exception raised when the model not support
""" """
description = "Model Currently Not Support" description = "Model Currently Not Support"




class InvokeRateLimitError(Exception):
class InvokeRateLimitError(ValueError):
"""Raised when the Invoke returns rate limit error.""" """Raised when the Invoke returns rate limit error."""


description = "Rate Limit Error" description = "Rate Limit Error"

Notiek ielāde…
Atcelt
Saglabāt