duneanalytics / dune-client

A framework for interacting with Dune Analytics' officially supported API service
Apache License 2.0
91 stars 21 forks source link

`insert_table` can't handle non 200 responses #128

Closed couralex6 closed 6 months ago

couralex6 commented 6 months ago

The InsertTableResult object only has one field (rows_written) which is only found in the 200 response:

{
  "rows_written": 9000,
  "bytes_written": 90
}

Codes 400, 401, 404, and 500 each have the following response schema:

{
  "error": "some error message"
}

When an insert error occurs, the client crashes and throws the error: KeyError: 'rows_written' without actually revealing the error returned by the API. This is making it hard to debug and to handle errors.

bh2smith commented 6 months ago

Closed by #129 - let me know if you need a new release immediately, or if it can just linger till the next improvement.