duneanalytics/dune-client

Revamp Messaging of QueryFailed

Opened this issue · 0 comments

Currently the error messaging naively outputs "Perhaps your query took too long to run" which is only one of many reasons a query execution could fail.

Here is an example of a failing query whose last execution has JOB_ID=01H9STYJ63ETQKCQ8PVG3NMREM.

{
  "execution_id": "01H9STYJ63ETQKCQ8PVG3NMREM",
  "query_id": 3008125,
  "state": "QUERY_STATE_FAILED",
  "submitted_at": "2023-09-08T07:26:21.893177Z",
  "expires_at": "2023-12-07T07:26:22.095658Z",
  "execution_started_at": "2023-09-08T07:26:21.907079Z",
  "execution_ended_at": "2023-09-08T07:26:22.095657Z",
  "error": {
    "type": "FAILED_TYPE_EXECUTION_FAILED",
    "message": "line 1:1: mismatched input 'selcjthehg'. Expecting: 'ALTER', 'ANALYZE', 'CALL', 'COMMENT', 'COMMIT', 'CREATE', 'DEALLOCATE', 'DELETE', 'DENY', 'DESC', 'DESCRIBE', 'DROP', 'EXECUTE', 'EXPLAIN', 'GRANT', 'INSERT', 'MERGE', 'PREPARE', 'REFRESH', 'RESET', 'REVOKE', 'ROLLBACK', 'SET', 'SHOW', 'START', 'TRUNCATE', 'UPDATE', 'USE', <query> at line 1, position 1 [Execution ID: 01H9STYJ63ETQKCQ8PVG3NMREM]",
    "metadata": {
      "line": 1,
      "column": 1
    }
  }
}

We could build the QueryFailed error type out of ExecutionResponse["error"].

Originally posted by @RichardKeo in #72 (comment)