Skip to content

Commit 4e88e7d

Browse files
authored
Improve Async error handling in the case of wrapped errors (#564)
1 parent e1d3e4f commit 4e88e7d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

test/cursor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func TestCreateCursorWithMaxRuntime(t *testing.T) {
5151
Name: "Too long query interrupted",
5252
SleepQuery: "1",
5353
MaxRuntime: 0.01,
54-
ExpectedError: "query killed (while executing)",
54+
ExpectedError: "query killed",
5555
},
5656
{
5757
Name: "Query passed before max runtime",

util/connection/wrappers/async/async_errors.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
package async
2222

2323
import (
24+
"errors"
2425
"fmt"
2526
)
2627

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

32-
if v, ok := err.(ErrorAsyncJobInProgress); ok {
33+
var v ErrorAsyncJobInProgress
34+
if errors.As(err, &v) {
3335
return v.jobID, true
3436
}
3537
return "", false

0 commit comments

Comments
 (0)