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

Poor or missing errors for invalid keyword arguments #3304

Closed
lupemba opened this issue Oct 18, 2023 · 1 comment
Closed

Poor or missing errors for invalid keyword arguments #3304

lupemba opened this issue Oct 18, 2023 · 1 comment
Labels

Comments

@lupemba
Copy link

lupemba commented Oct 18, 2023

Description

I have experienced that Makie does not throw any error or gives poor error messages in case of invalid keyword arguments.
I have given a small example using heatmap below. CairoMakie just ignores there invalid keyword arguments and GLMakie returns an obscure error message that does not contain the keyword argument.

This can easily lead new (and experienced) Makie users to spend a long time debugging simple mistakes in keyword arguments.

Environment info

This is tested in a fresh environment with
GLMakie version = "0.8.11"
CairoMakie version = "0.10.11"

Example

using GLMakie #or CairoMakie

x = 1:4
y = 1:5
data_values = [ x_i * y_i for y_i in y, x_i in x]

# Example of invalid argument
heatmap( x, y, data_values, random_invalid_argument =(-20,20))

# using Plots.jl keyword (common beginner mistake) 
heatmap( x, y, data_values; clims =(-20,20))

#The correct color range correct
heatmap( x, y, data_values, colorrange =(-20,20))

GKMakie error message

ERROR: MethodError: no method matching gl_convert(::Tuple{Int64, Int64})

Closest candidates are:
  gl_convert(::T) where T<:GeometryBasics.Mesh
   @ GLMakie C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\GLAbstraction\GLUniforms.jl:196
  gl_convert(::StaticArraysCore.SMatrix{N, M, T}) where {N, M, T}
   @ GLMakie C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\GLAbstraction\GLUniforms.jl:240
  gl_convert(::Quaternion)
   @ GLMakie C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\glshaders\particles.jl:28
  ...

Stacktrace:
  [1] #map#13
    @ C:\Users\Kok\.julia\packages\Observables\PHGQ8\src\Observables.jl:564 [inlined]
  [2] map
    @ C:\Users\Kok\.julia\packages\Observables\PHGQ8\src\Observables.jl:562 [inlined]
  [3] const_lift
    @ C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\GLAbstraction\GLUtils.jl:106 [inlined]
  [4] gl_convert(s::Observable{Tuple{Int64, Int64}})
    @ GLMakie.GLAbstraction C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\GLAbstraction\GLUniforms.jl:238
  [5] GLMakie.GLAbstraction.RenderObject(data::Dict{Symbol, Any}, program::GLMakie.GLVisualizeShader, pre::GLMakie.GLAbstraction.StandardPrerender, post::GLFW.Window, context::GLFW.Window)
    @ GLMakie.GLAbstraction C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\GLAbstraction\GLTypes.jl:444
  [6] GLMakie.GLAbstraction.RenderObject(data::Dict{Symbol, Any}, program::GLMakie.GLVisualizeShader, pre::GLMakie.GLAbstraction.StandardPrerender, post::GLFW.Window)
    @ GLMakie.GLAbstraction C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\GLAbstraction\GLTypes.jl:404
  [7] assemble_shader(data::Dict{Symbol, Any})
    @ GLMakie C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\glshaders\visualize_interface.jl:108
  [8] draw_heatmap(screen::Any, data::Dict)
    @ GLMakie C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\glshaders\image_like.jl:52
  [9] (::GLMakie.var"#233#238"{GLMakie.Screen{GLFW.Window}, Heatmap{Tuple{Vector{Float32}, Vector{Float32}, Matrix{Float32}}}})(gl_attributes::Dict{Symbol, Any})
    @ GLMakie C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\drawing_primitives.jl:455
 [10] (::GLMakie.var"#177#180"{GLMakie.var"#233#238"{GLMakie.Screen{GLFW.Window}, Heatmap{Tuple{Vector{Float32}, Vector{Float32}, Matrix{Float32}}}}, GLMakie.Screen{GLFW.Window}, Scene, Heatmap{Tuple{Vector{Float32}, Vector{Float32}, Matrix{Float32}}}})()
    @ GLMakie C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\drawing_primitives.jl:135
 [11] get!(default::GLMakie.var"#177#180"{GLMakie.var"#233#238"{GLMakie.Screen{GLFW.Window}, Heatmap{Tuple{Vector{Float32}, Vector{Float32}, Matrix{Float32}}}}, GLMakie.Screen{GLFW.Window}, Scene, Heatmap{Tuple{Vector{Float32}, Vector{Float32}, Matrix{Float32}}}}, h::Dict{UInt64, GLMakie.GLAbstraction.RenderObject}, key::UInt64)
    @ Base .\dict.jl:468
 [12] cached_robj!(robj_func::GLMakie.var"#233#238"{GLMakie.Screen{GLFW.Window}, Heatmap{Tuple{Vector{Float32}, Vector{Float32}, Matrix{Float32}}}}, screen::GLMakie.Screen{GLFW.Window}, scene::Scene, x::Heatmap{Tuple{Vector{Float32}, Vector{Float32}, Matrix{Float32}}})   
    @ GLMakie C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\drawing_primitives.jl:103
 [13] draw_atomic
    @ C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\drawing_primitives.jl:416 [inlined]
 [14] insert!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene, x::Heatmap{Tuple{Vector{Float32}, Vector{Float32}, Matrix{Float32}}})  
    @ GLMakie C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\drawing_primitives.jl:151
 [15] insertplots!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene)
    @ GLMakie C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\screen.jl:447
 [16] insertplots!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene) (repeats 2 times)
    @ GLMakie C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\screen.jl:450
 [17] display_scene!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene)
    @ GLMakie C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\screen.jl:379
 [18] GLMakie.Screen(scene::Scene, config::GLMakie.ScreenConfig; visible::Nothing, start_renderloop::Bool)
    @ GLMakie C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\screen.jl:396
 [19] GLMakie.Screen(scene::Scene, config::GLMakie.ScreenConfig)
    @ GLMakie C:\Users\Kok\.julia\packages\GLMakie\wkomB\src\screen.jl:392
 [20] getscreen(::Module, ::Scene; screen_config::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Makie C:\Users\Kok\.julia\packages\Makie\NrrbP\src\display.jl:408
 [21] getscreen
    @ C:\Users\Kok\.julia\packages\Makie\NrrbP\src\display.jl:391 [inlined]
 [22] display(figlike::Makie.FigureAxisPlot; backend::Module, inline::Bool, update::Bool, screen_config::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Makie C:\Users\Kok\.julia\packages\Makie\NrrbP\src\display.jl:161
 [23] display(figlike::Makie.FigureAxisPlot)
    @ Makie C:\Users\Kok\.julia\packages\Makie\NrrbP\src\display.jl:131
 [24] #invokelatest#2
    @ .\essentials.jl:819 [inlined]
 [25] invokelatest
    @ .\essentials.jl:816 [inlined]
 [26] (::VSCodeServer.var"#66#70"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()     
    @ VSCodeServer c:\Users\Kok\.vscode\extensions\julialang.language-julia-1.47.2\scripts\packages\VSCodeServer\src\eval.jl:199        
 [27] withpath(f::VSCodeServer.var"#66#70"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)
    @ VSCodeServer c:\Users\Kok\.vscode\extensions\julialang.language-julia-1.47.2\scripts\packages\VSCodeServer\src\repl.jl:249        
 [28] (::VSCodeServer.var"#65#69"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()     
    @ VSCodeServer c:\Users\Kok\.vscode\extensions\julialang.language-julia-1.47.2\scripts\packages\VSCodeServer\src\eval.jl:155        
 [29] hideprompt(f::VSCodeServer.var"#65#69"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})
odeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer c:\Users\Kok\.vscode\extensions\julialang.language-julia-1.47.2\scripts\packages\VSCodeServer\src\eval.jl:225        
 [34] #invokelatest#2
    @ .\essentials.jl:819 [inlined]
 [35] invokelatest(::Any)
    @ Base .\essentials.jl:816
 [36] macro expansion
    @ c:\Users\Kok\.vscode\extensions\julialang.language-julia-1.47.2\scripts\packages\VSCodeServer\src\eval.jl:34 [inlined]
 [37] (::VSCodeServer.var"#61#62")()
    @ VSCodeServer .\task.jl:514

@lupemba lupemba added the bug label Oct 18, 2023
@lupemba
Copy link
Author

lupemba commented Oct 18, 2023

This is a duplicate of issue #3209
And is worked on in pr #2966

@lupemba lupemba closed this as completed Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant