Skip to content

Commit

Permalink
fix: improve error handling in NotionOAuth for block parent page ID r… (
Browse files Browse the repository at this point in the history
#12268)

Signed-off-by: -LAN- <laipz8200@outlook.com>
  • Loading branch information
laipz8200 authored Dec 31, 2024
1 parent c7911c7 commit 5b6950e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/libs/oauth_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ def notion_block_parent_page_id(self, access_token: str, block_id: str):
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":
Expand Down

0 comments on commit 5b6950e

Please sign in to comment.