Skip to content

Commit bbed887

Browse files
Merge pull request #124 from wp-media/develop
Add code and message to the Notion API error message
2 parents 4fe60b7 + 8a38e9e commit bbed887

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sources/factories/NotionFactory.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def _create_notion_db_row(self, app_context, db_id, properties, children):
5757
)
5858

5959
if response.status_code != 200:
60-
raise ValueError('Notion API could not create the DB row.')
60+
error_message = f"Notion API could not create the DB row. Response code: {response.status_code}. Error message: "
61+
error_message += f"{getattr(response, 'code', 'No code')}: {getattr(response, 'message', 'No message')}"
62+
raise ValueError(error_message)
6163
page_id = response.json().get('id')
6264
page_id_linkable = page_id.replace('-', '')
6365
page_url = f'https://www.notion.so/wpmedia/{page_id_linkable}'

0 commit comments

Comments
 (0)