Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: improve error handling in NotionOAuth for block parent page ID r… (#12268)

-LAN-5b6950e545a2
diff --git a/api/libs/oauth_data_source.py b/api/libs/oauth_data_source.py
index 0c872a0066d..a5ba08d351c 100644
--- a/api/libs/oauth_data_source.py
+++ b/api/libs/oauth_data_source.py
@@ -255,7 +255,8 @@ class NotionOAuth(OAuthDataSource):
response = requests.get(url=f"{self._NOTION_BLOCK_SEARCH}/{block_id}", headers=headers)
response_json = response.json()
if response.status_code != 200:
- raise ValueError(f"Error fetching block parent page ID: {response_json.message}")
+ message = response_json.get("message", "unknown error")
+ raise ValueError(f"Error fetching block parent page ID: {message}")
parent = response_json["parent"]
parent_type = parent["type"]
if parent_type == "block_id":