You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am wondering if these two errors are supposed to be considered equivalent? I notice they are documented the same, and obviously have the same error message.
At my workplace we were just caught out by an index.ErrNotFound error in the following code:
// ListCustomers returns a slice of Customers.funcListCustomers(ctx context.Context, tx storm.Node) ([]Customer, error) {
varc []Customererr:=tx.AllByIndex("Username", &c)
iferrors.Is(err, storm.ErrNotFound) { // note: errors.Is() does not match index.ErrNotFoundreturnc, nil
}
returnc, err
}
I was just hoping for some guidance as to whether I should be handling both errors explicitly.
Thanks 😄
/cc @cwx-iggy
PS: If these errors are supposed to be equivalent, but have been duplicated to avoid a cyclic package dependency, perhaps the construction via errors.New() could be moved into an internal package and referenced from both the storm and index packages?
The text was updated successfully, but these errors were encountered:
Hi, I am wondering if these two errors are supposed to be considered equivalent? I notice they are documented the same, and obviously have the same error message.
At my workplace we were just caught out by an
index.ErrNotFound
error in the following code:I was just hoping for some guidance as to whether I should be handling both errors explicitly.
Thanks 😄
/cc @cwx-iggy
PS: If these errors are supposed to be equivalent, but have been duplicated to avoid a cyclic package dependency, perhaps the construction via
errors.New()
could be moved into aninternal
package and referenced from both thestorm
andindex
packages?The text was updated successfully, but these errors were encountered: