Skip to content

Commit 07df691

Browse files
committed
Fix errors
1 parent fdc626b commit 07df691

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

core/composio/sdk/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def generate_cli_auth_session(self):
8888
if resp.get('key'):
8989
return resp['key']
9090

91-
raise Exception("Bad request to cli/generate-cli-session")
91+
raise Exception(f"Bad request to cli/generate-cli-session. Status code: {resp.status_code}, response: {resp.text}")
9292

9393
def verify_cli_auth_session(self, key: str, code: str):
9494
resp = self.http_client.get(f"{self.base_url}/v1/cli/verify-cli-code?key={key}&code={code}");
@@ -97,7 +97,7 @@ def verify_cli_auth_session(self, key: str, code: str):
9797
elif resp.status_code == 401:
9898
raise UnauthorizedAccessException("UnauthorizedError: Unauthorized access to cli/verify-cli-session")
9999

100-
raise Exception("Bad request to cli/verify-cli-session")
100+
raise Exception(f"Bad request to cli/verify-cli-session. Status code: {resp.status_code}, response: {resp.text}")
101101

102102
def initiate_connection(self, appName: Union[str, App], integrationId: str = None) -> ConnectionRequest:
103103
if integrationId is None:
@@ -112,7 +112,7 @@ def initiate_connection(self, appName: Union[str, App], integrationId: str = Non
112112
if resp.status_code == 200:
113113
return ConnectionRequest(self.sdk, **resp.json())
114114

115-
raise Exception("Failed to create connection")
115+
raise Exception(f"Failed to create connection. Status code: {resp.status_code}, response: {resp.text}")
116116

117117
def set_global_trigger(self, callback_url: str):
118118
try:

core/composio/sdk/sdk.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def _execute_action(
105105
)
106106
if resp.status_code == 200:
107107
return resp.json()
108-
raise Exception("Failed to execute action, response: ", resp.text)
108+
raise Exception(f"Failed to execute action, status code: {resp.status_code}, response: {resp.text}")
109109

110110
def execute_action(self, action_name: Action, params: dict):
111111
resp = self._execute_action(action_name, self.id, params)
@@ -133,7 +133,7 @@ def get_all_actions(self, format: SchemaFormat = SchemaFormat.OPENAI):
133133
else:
134134
return actions["items"]
135135

136-
raise Exception("Failed to get actions. You might want to run composio-cli update and restart the python notebook to reload the updated library.")
136+
raise Exception(f"Failed to get actions. Status code: {resp.status_code}, response: {resp.text}")
137137

138138
def handle_tools_calls(self, tool_calls: ChatCompletion) -> list[any]:
139139
output = []
@@ -195,7 +195,7 @@ def initiate_connection(
195195
if resp.status_code == 200:
196196
return ConnectionRequest(self.sdk_instance, **resp.json())
197197

198-
raise Exception("Failed to create connection")
198+
raise Exception(f"Failed to create connection. Status code: {resp.status_code}, response: {resp.text}")
199199

200200
def get_required_variables(self):
201201
return self.expectedInputFields
@@ -229,7 +229,7 @@ def list_active_triggers(self, trigger_ids: list[str] = None) -> list[ActiveTrig
229229
raise Exception(f"Failed to get active triggers, status code: {resp.status_code}, response: {resp.text}")
230230
if resp.json().get("triggers"):
231231
return [ActiveTrigger(self, **item) for item in resp.json()["triggers"]]
232-
raise Exception(f"Failed to get active triggers, response: {resp.text}")
232+
raise Exception(f"Failed to get active triggers, status code: {resp.status_code}, response: {resp.text}")
233233

234234
def disable_trigger(self, trigger_id: str):
235235
resp = self.http_client.post(f"{self.base_url}/v1/triggers/disable/{trigger_id}")

0 commit comments

Comments
 (0)