mariosimao / notion-sdk-php

A complete Notion SDK for PHP developers.
https://mariosimao.github.io/notion-sdk-php/
MIT License
140 stars 24 forks source link

[BUG] ApiException fromResponse not handled properly causes TypeError #289

Closed samihsoylu closed 9 months ago

samihsoylu commented 10 months ago

Describe the bug A 400 response might occasionally lack a body or message. This can trigger a type error in the ApiException class due to the absence of a message for the constructor.

Sentry Stacktrace of the $message being missing image

And Sentry Stacktrace of the body being missing: image

To Reproduce The cause of this intermittent response is unclear, so I can't provide exact steps for replication. While it occurs multiple times daily, the majority of my API calls are successful.

Expected behavior It might be more effective to create a generic exception for these situations. This would allow me to catch it and try again

Environment (please complete the following information):