소스 검색

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

Trey Dong 7 달 전
부모
커밋
41d90c2408
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      api/libs/oauth_data_source.py

+ 2 - 0
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":