mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
451f252c0f
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4817 GitOrigin-RevId: 340f8d0cb3df496c1c0df1cc60fe3752dd58c75c
29 lines
587 B
Go
29 lines
587 B
Go
package errors
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"net/url"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestUnwrappingErrorsWithKind(t *testing.T) {
|
|
e := E("Test", KindNetwork, &url.Error{
|
|
Op: "Test URL Error",
|
|
URL: "https://test-url",
|
|
Err: fmt.Errorf("something"),
|
|
})
|
|
|
|
assert.True(t, IsKind(KindNetwork, e))
|
|
var urlErr *url.Error
|
|
assert.True(t, errors.As(e, &urlErr))
|
|
}
|
|
|
|
func TestCanGetWrappedKind(t *testing.T) {
|
|
e1 := E("E1", KindHasuraAPI, "some bad error")
|
|
e2 := E("E2", fmt.Errorf("something bad occured: %w", e1))
|
|
assert.True(t, IsKind(KindHasuraAPI, e2))
|
|
}
|