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

DataFrame#plot should provide more informative error message. #479

Open
matugm opened this issue Jan 12, 2019 · 2 comments
Open

DataFrame#plot should provide more informative error message. #479

matugm opened this issue Jan 12, 2019 · 2 comments

Comments

@matugm
Copy link
Contributor

matugm commented Jan 12, 2019

As mentioned in #478 I find that some error messages could be improved to provide a better user experience.

For example:

require 'daru'

df = Daru::DataFrame.new(
  { "Row 1" => [1, 2, 3],
    "Row 2"  =>  [3, 4, 5]
  }
)

df.plot(type: :bar, x: "Row 1")

Results in:

NoMethodError (undefined method `to_sym' for nil:NilClass)

But this error doesn't help the user understand that there is a missing y value.

There are other errors like these where missing or incorrect data leads into an exception.

Another Example:

If you don't provide a plot type at all you get "NameError (wrong constant name)". It may be more helpful to provide a list of valid plot types in this case.

@Shekharrajak
Copy link
Member

Yes! There should be begin, rescue block to handle any kind of error coming from another gem. It must throw an error with the correct input type.

@Shekharrajak
Copy link
Member

We can have a custom error class for daru library.

@v0dro v0dro changed the title Improve error messages & error handling DataFrame#plot should provide more informative error message. May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants