Skip to content

Commit 17ee731

Browse files
SearchApi - Return error message instead of raising a ValueError (#11083)
1 parent af2461c commit 17ee731

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

api/core/tools/provider/builtin/searchapi/tools/google.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def get_params(self, query: str, **kwargs: Any) -> dict[str, str]:
4545
def _process_response(res: dict, type: str) -> str:
4646
"""Process response from SearchAPI."""
4747
if "error" in res:
48-
raise ValueError(f"Got error from SearchApi: {res['error']}")
48+
return res["error"]
4949

5050
toret = ""
5151
if type == "text":

api/core/tools/provider/builtin/searchapi/tools/google_jobs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def get_params(self, query: str, **kwargs: Any) -> dict[str, str]:
4545
def _process_response(res: dict, type: str) -> str:
4646
"""Process response from SearchAPI."""
4747
if "error" in res:
48-
raise ValueError(f"Got error from SearchApi: {res['error']}")
48+
return res["error"]
4949

5050
toret = ""
5151
if type == "text":

api/core/tools/provider/builtin/searchapi/tools/google_news.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def get_params(self, query: str, **kwargs: Any) -> dict[str, str]:
4545
def _process_response(res: dict, type: str) -> str:
4646
"""Process response from SearchAPI."""
4747
if "error" in res:
48-
raise ValueError(f"Got error from SearchApi: {res['error']}")
48+
return res["error"]
4949

5050
toret = ""
5151
if type == "text":

api/core/tools/provider/builtin/searchapi/tools/youtube_transcripts.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def get_params(self, video_id: str, language: str, **kwargs: Any) -> dict[str, s
4545
def _process_response(res: dict) -> str:
4646
"""Process response from SearchAPI."""
4747
if "error" in res:
48-
raise ValueError(f"Got error from SearchApi: {res['error']}")
48+
return res["error"]
4949

5050
toret = ""
5151
if "transcripts" in res and "text" in res["transcripts"][0]:

0 commit comments

Comments
 (0)