From 41d90c24082814f05b3aa55b0532785b648988a5 Mon Sep 17 00:00:00 2001 From: Trey Dong <1346650911@qq.com> Date: Mon, 9 Dec 2024 09:10:59 +0800 Subject: [PATCH] fix(api): throw error when notion block can not find (#11433) --- api/libs/oauth_data_source.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/libs/oauth_data_source.py b/api/libs/oauth_data_source.py index 48249e4a35..1d39abd8fa 100644 --- a/api/libs/oauth_data_source.py +++ b/api/libs/oauth_data_source.py @@ -253,6 +253,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}") parent = response_json["parent"] parent_type = parent["type"] if parent_type == "block_id":