fix(api): throw error when notion block can not find (#11433)

This commit is contained in:
Trey Dong 2024-12-09 09:10:59 +08:00 committed by GitHub
parent 7ff42b1b7a
commit 41d90c2408
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -253,6 +253,8 @@ class NotionOAuth(OAuthDataSource):
} }
response = requests.get(url=f"{self._NOTION_BLOCK_SEARCH}/{block_id}", headers=headers) response = requests.get(url=f"{self._NOTION_BLOCK_SEARCH}/{block_id}", headers=headers)
response_json = response.json() 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 = response_json["parent"]
parent_type = parent["type"] parent_type = parent["type"]
if parent_type == "block_id": if parent_type == "block_id":