Skip to content

jinzhu/gorm: Ignore some errors like record not found #805

Description

@moonsub-kim

I wish ignore errors especially record not found that is unnecessary to classify as errors in my server.
image
The server queries by request from the client that can manipulate req body, then we always allow record_not_found error.
Most of record_not_found error makes me indifferent to see error rate dashboard.

To Extendability,I 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalmore in depth change that requires full team approval

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions