fix: extend catch_unwind to cover lock_pypi_packages for proper panic handling#5324
Conversation
… handling Moves the lock_pypi_packages call inside the catch_unwind block to properly catch panics that occur during wheel metadata fetching. Also moves the last_initialization_error method to LazyBuildDispatchDependencies since the LazyBuildDispatch is moved into the async block. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Looks good to me and I think the error message is much better! I'll let @tdejager have another look at the code. |
|
Nice! Maybe it would be good to move the last error out of the dependencies structure altogether, as it does not really count as a dependency. |
| pub fn last_initialization_error(&self) -> Option<&LazyBuildDispatchError> { | ||
| self.last_error.get() |
There was a problem hiding this comment.
Not sure if it would be doable to pull this out, or we need to rename the struct ;)
|
Also make sure to fill out the AI disclosure fully :) |
|
Actually, now that I look at the description, I'm unsure what actually changed in the output. Is the description correct, from the original issue it seems that the miette error was never printed? |
the error itself from locking was never printed and only panicked |
fixes: #5315
Summary
lock_pypi_packagescall inside thecatch_unwindblock to properly catch panics that occur during wheel metadata fetchinglast_initialization_error()method fromLazyBuildDispatchtoLazyBuildDispatchDependenciessinceLazyBuildDispatchis moved into the async block and can't be accessed after the catch_unwindThis fixes panics like:
Testing
Tested by cloning the repository from the issue, and instead of using vendored conda package
I'm using the one from pypi
When trying to lock, it produces the right error:

AI Disclosure
Tools: Claude
Checklist:
schema/model.py.