Skip to content

Commit

Permalink
Improve Async error handling in the case of wrapped errors (#564)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwierzbo authored Oct 24, 2023
1 parent e1d3e4f commit 4e88e7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/cursor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestCreateCursorWithMaxRuntime(t *testing.T) {
Name: "Too long query interrupted",
SleepQuery: "1",
MaxRuntime: 0.01,
ExpectedError: "query killed (while executing)",
ExpectedError: "query killed",
},
{
Name: "Query passed before max runtime",
Expand Down
4 changes: 3 additions & 1 deletion util/connection/wrappers/async/async_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package async

import (
"errors"
"fmt"
)

Expand All @@ -29,7 +30,8 @@ func IsAsyncJobInProgress(err error) (string, bool) {
return "", false
}

if v, ok := err.(ErrorAsyncJobInProgress); ok {
var v ErrorAsyncJobInProgress
if errors.As(err, &v) {
return v.jobID, true
}
return "", false
Expand Down

0 comments on commit 4e88e7d

Please sign in to comment.