dstotijn / go-notion

Go client for the Notion API.
MIT License
380 stars 39 forks source link

handle unknown errors #51

Closed bassettb closed 1 year ago

bassettb commented 1 year ago

Notion doesn't always return an error object. In those cases, let's at least inform the caller with the StatusCode.

I see this in the logs. It appears Notion is replying with html instead of json. failed to search: failed to parse error from HTTP response: invalid character '<' looking for beginning of value

The json parsing error isn't very helpful, so just populate the StatusCode instead.