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

Calls to panic() in table.go #69

Open
epineapple opened this issue Feb 19, 2020 · 1 comment
Open

Calls to panic() in table.go #69

epineapple opened this issue Feb 19, 2020 · 1 comment

Comments

@epineapple
Copy link
Contributor

Instead of calling panic(), the Init, ReadTable and WriteTable functions in table.go should return the error. Using LXRHash from a larger program is made more difficult because of these panic() calls.

I'm happy to submit a PR. I thought I should open this discussion to make sure that others agree.

@Emyrk
Copy link
Member

Emyrk commented Feb 26, 2020

We already have a lot of apps using the existing api. If we were to add an error return, it would break those apps when they update.

If we remove the panic, I'd like to maintain the old interface to the library, and add the additional apis for the optional return with a comment deprecating the old and allowing for time to update.

E.g:

// Deprecated: Panics on error instead of returning an error. Please use "InitTable()"
func Init(...) {
    err := InitTable(...)
    if err != nil {
        panic(err)
    }
}

func InitTable(...) err {
     ...
}

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

No branches or pull requests

2 participants