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

proposal: gorm.io/gorm.v1 - Ignore some errors like record not found #915

Closed
vmlellis opened this issue May 2, 2021 · 1 comment
Closed
Labels
proposal/accepted Accepted proposals proposal more in depth change that requires full team approval

Comments

@vmlellis
Copy link
Contributor

vmlellis commented May 2, 2021

I wish ignore errors such as "record not found", that is unnecessary to classify as error.

It is the same suggestion to jinzhu/gorm (#805), it's interesting to keep the same option in case the jinzhu/gorm be upgraded to gorm.io/gorm.v1 .

As suggested in the issue of jinzhu/gorm, I also suggest adding an option that can ignore some type of errors like below:

WithErrorFilter(func(err error) bool{
    if errors.Is(err, gorm.ErrRecordNotFound) {
        return false
    }
    return true
})

If you agree about it, I will make a PR.

@vmlellis vmlellis changed the title gorm.io/gorm.v1: Ignore some errors like record not found contrib/gorm.io/gorm.v1: Ignore some errors like record not found May 2, 2021
@vmlellis vmlellis changed the title contrib/gorm.io/gorm.v1: Ignore some errors like record not found gorm.io/gorm.v1: Ignore some errors like record not found May 2, 2021
@vmlellis vmlellis changed the title gorm.io/gorm.v1: Ignore some errors like record not found proposal: gorm.io/gorm.v1 - Ignore some errors like record not found May 6, 2021
@knusbaum
Copy link
Contributor

knusbaum commented May 26, 2021

+1 This proposal looks acceptable to me.

@knusbaum knusbaum added the proposal more in depth change that requires full team approval label May 26, 2021
@knusbaum knusbaum added the proposal/accepted Accepted proposals label Aug 26, 2021
@gbbr gbbr closed this as completed in 45529e2 Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal/accepted Accepted proposals proposal more in depth change that requires full team approval
Projects
None yet
Development

No branches or pull requests

2 participants