From 5b6950e545a2a638b3117b226c97c705653a74b4 Mon Sep 17 00:00:00 2001 From: -LAN- Date: Tue, 31 Dec 2024 17:03:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20improve=20error=20handling=20in=20Notion?= =?UTF-8?q?OAuth=20for=20block=20parent=20page=20ID=20r=E2=80=A6=20(#12268?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: -LAN- --- api/libs/oauth_data_source.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/libs/oauth_data_source.py b/api/libs/oauth_data_source.py index 0c872a0066..a5ba08d351 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":