Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make not-found errors discoverable #133

Merged
merged 2 commits into from Aug 29, 2019
Merged

feat: make not-found errors discoverable #133

merged 2 commits into from Aug 29, 2019

Conversation

Stebalien
Copy link
Member

Now we just need a common place to put:

func IsNotFound(e error) bool {
  for e != nil {
    if ne, ok := e.(interface { NotFound() bool }); ok {
      return ne.NotFound()
    }
    if ue, ok := e.(interface { Unwrap() error }); ok {
      e = ue.Unwrap()
    } else {
      return false
    }
  }
  return false
}

Now we just need a common place to put:

func IsNotFound(e error) bool {
  for e != nil {
    if ne, ok := e.(interface { NotFound() bool }); ok {
      return ne.NotFound()
    }
    if ue, ok := e.(interface { Unwrap() error }); ok {
      e = ue.Unwrap()
    } else {
      return false
    }
  }
  return false
}
@Stebalien Stebalien merged commit c85adc5 into master Aug 29, 2019
@Stebalien Stebalien deleted the fix/not-found branch August 29, 2019 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants