duneanalytics / dune-client

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

Update QueryFailed error to include failure info. #96

Closed bh2smith closed 1 year ago

bh2smith commented 1 year ago

When attempting to query a parameterized address with invalid string data we get error responses like:

export JOB_ID=01HBJFT6X600Z00VAJQFA9HQ5N
➜  ~ curl -X GET "https://api.dune.com/api/v1/execution/${JOB_ID}/results" -H x-dune-api-key:${DUNE_API_KEY}
{
  "execution_id": "01HBJFT6X600Z00VAJQFA9HQ5N",
  "query_id": 1416166,
  "state": "QUERY_STATE_FAILED",
  "submitted_at": "2023-09-30T07:28:27.558928Z",
  "expires_at": "2023-12-29T07:28:27.751448Z",
  "execution_started_at": "2023-09-30T07:28:27.564121Z",
  "execution_ended_at": "2023-09-30T07:28:27.751447Z",
  "error": {
    "type": "FAILED_TYPE_EXECUTION_FAILED",
    "message": "line 24:13: Binary literal can only contain hexadecimal digits at line 24, position 13 [Execution ID: 01HBJFT6X600Z00VAJQFA9HQ5N]",
    "metadata": {
      "line": 24,
      "column": 13
    }
  }
}

Which contain clear error message. This was not an issue before when using spark because spark used strings for binary data.

This PR improves the error notification by actually returning the error.