Skip to content

Commit

Permalink
optimize firecrawl error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnJyong committed Jun 6, 2024
1 parent 2ad4e2f commit 43f4e3a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/controllers/console/auth/data_source_bearer_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from controllers.console import api
from libs.login import login_required
from services.auth.api_key_auth_service import ApiKeyAuthService
from controllers.console.auth.error import ApiKeyAuthFailedError

from ..setup import setup_required
from ..wraps import account_initialization_required

Expand Down Expand Up @@ -42,7 +44,7 @@ def post(self):
try:
ApiKeyAuthService.create_provider_auth(current_user.current_tenant_id, args)
except Exception as e:
return {'error': str(e)}, 500
raise ApiKeyAuthFailedError(str(e))
return {'result': 'success'}, 200


Expand Down
7 changes: 7 additions & 0 deletions api/controllers/console/auth/error.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from libs.exception import BaseHTTPException


class ApiKeyAuthFailedError(BaseHTTPException):
error_code = 'auth_failed'
description = "{message}"
code = 500

0 comments on commit 43f4e3a

Please sign in to comment.