-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add error hints for package extensions #184
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #184 +/- ##
==========================================
- Coverage 98.35% 98.19% -0.16%
==========================================
Files 11 12 +1
Lines 1215 1220 +5
==========================================
+ Hits 1195 1198 +3
- Misses 20 22 +2 ☔ View full report in Codecov by Sentry. |
src/Visualize.jl
Outdated
if Symbol(exc.f) in fns && !is_pkg_loaded(pkg) | ||
print( | ||
io, | ||
"\nImport $pkg to enable `$(exc.f)`. You might also need to import Makie and its backends (CairoMakie, GLMake, etc.) as well."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should split and return the precise package that needs to be leaded (ie, a Makie backend or GeoMakie)
Also, I don't know if it helps but there's a Base.get_extension
function that directly checks if the extension has been loaded. I am not sure if there's any advantage with respect to using is_pkg_loaded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible to use Base.get_extension
instead of is_pkg_loaded
. For this particular case, it doesn't matter since you just need to load in one package to enable the extension. However, if an extension requires multiple packages to be loaded, then just checking the extension means you don't know what packages are loaded or are not loaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thank you!
3956c15
to
5154e23
Compare
Thank you! |
closes #15 - This PR adds error hints for functions in the package extensions.
For example, if you run this
Then, you get the error