Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions api/core/errors/error.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Optional


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

description: Optional[str] = None
Expand All @@ -16,7 +16,7 @@ class LLMBadRequestError(LLMError):
description = "Bad Request"


class ProviderTokenNotInitError(Exception):
class ProviderTokenNotInitError(ValueError):
"""
Custom exception raised when the provider token is not initialized.
"""
Expand All @@ -27,31 +27,31 @@ def __init__(self, *args, **kwargs):
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.
"""

description = "Quota Exceeded"


class AppInvokeQuotaExceededError(Exception):
class AppInvokeQuotaExceededError(ValueError):
"""
Custom exception raised when the quota for an app has been exceeded.
"""

description = "App Invoke Quota Exceeded"


class ModelCurrentlyNotSupportError(Exception):
class ModelCurrentlyNotSupportError(ValueError):
"""
Custom exception raised when the model not support
"""

description = "Model Currently Not Support"


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

description = "Rate Limit Error"
Loading