Skip to content

Commit 6061109

Browse files
author
nazarfil
committed
use wrapper method in api
1 parent ef2d29f commit 6061109

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

openhexa/cli/api.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def handle_ssl_error(e):
3737
"SSL certificate verification failed. "
3838
"If you want to disable SSL verification, set the environment variable: HEXA_VERIFY_SSL=false"
3939
)
40-
raise
4140

4241

4342
class InvalidDefinitionError(Exception):
@@ -794,11 +793,7 @@ def execute(self, query, **kwargs):
794793
try:
795794
response = super().execute(query=query, **kwargs)
796795
except Exception as e:
797-
if "CERTIFICATE_VERIFY_FAILED" in str(e):
798-
raise GraphQLError(
799-
"SSL certificate verification failed. "
800-
"If you want to disable SSL verification, set the environment variable: HEXA_VERIFY_SSL=false"
801-
)
796+
handle_ssl_error(e)
802797
raise
803798

804799
if settings.debug:
@@ -813,12 +808,8 @@ def get_data(self, response: httpx.Response) -> dict[str, Any]:
813808
try:
814809
data = super().get_data(response)
815810
except Exception as e:
816-
if "CERTIFICATE_VERIFY_FAILED" in str(e):
817-
raise GraphQLError(
818-
"SSL certificate verification failed. "
819-
"If you want to disable SSL verification, set the environment variable: HEXA_VERIFY_SSL=false"
820-
)
821-
elif "Resolver requires an authenticated user" in str(e):
811+
handle_ssl_error(e)
812+
if "Resolver requires an authenticated user" in str(e):
822813
raise InvalidTokenError("No or invalid token found for workspace, please check your configuration.")
823814
raise
824815
return data

0 commit comments

Comments
 (0)