Skip to content

Commit

Permalink
Merge pull request #124 from wp-media/develop
Browse files Browse the repository at this point in the history
Add code and message to the Notion API error message
  • Loading branch information
MathieuLamiot authored Oct 23, 2024
2 parents 4fe60b7 + 8a38e9e commit bbed887
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sources/factories/NotionFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def _create_notion_db_row(self, app_context, db_id, properties, children):
)

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

0 comments on commit bbed887

Please sign in to comment.