sourcegraph/internal/database/errors_test.go
Quinn Slack f6fe8df922
add database.NotFoundError helper type (#63671)
Use it in the 1 place it seemed obvious. I have other changes where it
will be used in more places. This helps standardize our codebase.

## Test plan

CI
2024-07-05 14:26:19 +00:00

23 lines
423 B
Go

package database
import (
"testing"
"github.com/sourcegraph/sourcegraph/internal/errcode"
)
func TestResourceNotFoundError(t *testing.T) {
err := resourceNotFoundError{"foo"}
if want := "foo not found"; err.Error() != want {
t.Errorf("got %q, want %q", err, want)
}
if !errcode.IsNotFound(resourceNotFoundError{"foo"}) {
t.Fatal()
}
if !errcode.IsNotFound(&resourceNotFoundError{"foo"}) {
t.Fatal()
}
}