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

Uninformative error for column typos #99

Closed
jkrumbiegel opened this issue Oct 14, 2020 · 2 comments
Closed

Uninformative error for column typos #99

jkrumbiegel opened this issue Oct 14, 2020 · 2 comments

Comments

@jkrumbiegel
Copy link
Member

Currently, if one writes the name of a data column incorrectly and it's not found, the code errors when a findfirst call returning nothing is supposed to be coerced to an Int index. So the error thrown is:

ERROR: LoadError: MethodError: Cannot `convert` an object of type Nothing to an object of type Int64
Closest candidates are:
  convert(::Type{T}, ::AbstractPlotting.Unit) where T<:Number at C:\Users\krumbiegel\.julia\packages\AbstractPlotting\lGPof\src\units.jl:31 
  convert(::Type{T}, ::T) where T<:Number at number.jl:6
  convert(::Type{T}, ::Number) where T<:Number at number.jl:7
  ...
Stacktrace:
 [1] getcolumn(::AlgebraOfGraphics.ColumnDict, ::Symbol) at C:\Users\krumbiegel\.julia\packages\AlgebraOfGraphics\chGdQ\src\utils.jl:11     
 [2] extract_column(::AlgebraOfGraphics.ColumnDict, ::Pair{Symbol,typeof(identity)}) at C:\Users\krumbiegel\.julia\packages\AlgebraOfGraphics\chGdQ\src\context.jl:164

I would suggest that rather than writing a more informative message right at that point, this problem should be handled further up the chain so that we can say "invalid column name $xyz for keyword color / positional argument 2 / etc."

@piever
Copy link
Collaborator

piever commented Oct 15, 2020

I agree, that error is really not great. For now I'm adding a better one in #100, in the future we can think if there is a smart way to catch this further up (probably already when multiplying the data with the mapping).

@jkrumbiegel
Copy link
Member Author

I'm going to close this, we can always look for a more complete solution later :)

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