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

Better error message when creating a block without passing a figure argument #4702

Open
asinghvi17 opened this issue Jan 6, 2025 · 0 comments
Labels
documentation enhancement Feature requests and enhancements Errors & Warnings Missing/Bad errors Makie Backend independent issues (Makie core)

Comments

@asinghvi17
Copy link
Member

Currently, the error looks like this:

julia> LScene()
ERROR: MethodError: no method matching _block(::Type{LScene})
The function `_block` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  _block(::Type{<:Makie.Block}, ::Union{Figure, Scene}, ::Any, ::Dict, ::Any; kwdict_complete)
   @ Makie ~/.julia/dev/Makie/src/makielayout/blocks.jl:317
  _block(::Type{<:Makie.Block}, ::Union{Figure, Scene}, ::Any...; bbox, kwargs...)
   @ Makie ~/.julia/dev/Makie/src/makielayout/blocks.jl:261
  _block(::Type{<:Makie.Block}, ::Union{GridPosition, GridSubposition}, ::Any...; kwargs...)
   @ Makie ~/.julia/dev/Makie/src/makielayout/blocks.jl:249

Stacktrace:
 [1] LScene(; kwargs::@Kwargs{})
   @ Makie ~/.julia/dev/Makie/src/makielayout/blocks.jl:240
 [2] LScene()
   @ Makie ~/.julia/dev/Makie/src/makielayout/blocks.jl:239
 [3] top-level scope
   @ REPL[3]:1

(note the lack of a grid position as the first arg)

We should change this to something like:

ArgumentError: when creating a $blocktype, you have not provided a layout position or a figure in which the block should exist as the first argument.

Make sure you provide this first argument, as so:

$blocktype(fig[i, j], ...)
$blocktype(fig, ...)

or so.

@asinghvi17 asinghvi17 added the enhancement Feature requests and enhancements label Jan 6, 2025
@ffreyer ffreyer added documentation Makie Backend independent issues (Makie core) Errors & Warnings Missing/Bad errors labels Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation enhancement Feature requests and enhancements Errors & Warnings Missing/Bad errors Makie Backend independent issues (Makie core)
Projects
None yet
Development

No branches or pull requests

2 participants