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

How about raise ArgumentError rather than just calling error() in insertcols!()? #1867

Closed
petershintech opened this issue Jul 4, 2019 · 2 comments

Comments

@petershintech
Copy link
Contributor

I found the following case is the perfect case to raise ArgumentError(). What do you think of it?

function insertcols!(df::DataFrame, col_ind::Int, name_col::Pair{Symbol, <:AbstractVector};
                     makeunique::Bool=false)
    name, item = name_col
    0 < col_ind <= ncol(df) + 1 || throw(BoundsError())
    size(df, 1) == length(item) || size(df, 2) == 0 || error("number of rows does not match")

    if hasproperty(df, name)
@bkamins
Copy link
Member

bkamins commented Jul 4, 2019

Sure - feel free to open a PR to improve both throw(BoundsError()) and error.

@bkamins
Copy link
Member

bkamins commented Dec 1, 2019

fixed

@bkamins bkamins closed this as completed Dec 1, 2019
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