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

Improve error message when extension file does not contain module #51626

Closed
jakobnissen opened this issue Oct 7, 2023 · 1 comment · Fixed by #51635
Closed

Improve error message when extension file does not contain module #51626

jakobnissen opened this issue Oct 7, 2023 · 1 comment · Fixed by #51635
Labels
error messages Better, more actionable error messages package extensions

Comments

@jakobnissen
Copy link
Contributor

I just tried to create a package extension, but forgot to wrap the code in the extension file in its own module. I got an error saying:

[ Info: Precompiling TestExt [29286dec-c893-52d1-88fe-e07e79eb4405]
ERROR: LoadError: ArgumentError: Package Base does not have Test in its dependencies:
- You may have a partially installed environment. Try `Pkg.instantiate()`
  to ensure all packages in the environment are installed.
- Or, if you have Base checked out for development and have
  added Test as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with Base
Stacktrace:
 [1] macro expansion
   @ Base ./loading.jl:1770 [inlined]
 [2] macro expansion
   @ Base ./lock.jl:267 [inlined]
 [3] __require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1747

IMO this error is pretty confusing because it claimed I was trying to load Test from Base, whereas in fact, I tried loading it in my extension module.

@jakobnissen jakobnissen added error messages Better, more actionable error messages package extensions labels Oct 7, 2023
@IanButterworth
Copy link
Member

Investigating this I also noticed that Pkg.precompile reports the failure but swallows the error

(@v1.11) pkg> precompile
Precompiling project...
  ✗ PGFPlotsX → ColorsExt
  0 dependencies successfully precompiled in 1 seconds. 53 already precompiled.

(@v1.11) pkg> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error messages Better, more actionable error messages package extensions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants