-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Error info has been added to LoadState::Failed #12709
Error info has been added to LoadState::Failed #12709
Conversation
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.
Really pleased to see this! I think we should stick with the derived PartialEq
and Eq
implementations (and derive down the tree as needed), but otherwise I'm pleased.
We should also derive Debug
and Error
(via thiserror
) while we're here.
The migration guide will need to cover the new variant, and the removed traits (Copy
, Ord
and PartialOrd
).
crates/bevy_asset/src/server/mod.rs
Outdated
} | ||
|
||
impl PartialEq for LoadState { |
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.
I don't think we want this: IMO we want to use the standard derived equality here. If users want this behavior it's easy for them to use it manually.
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.
Standard derived equality requires recursive equality implementations for all nested structures, should I add derived equality for all of them?
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.
Yes please :) Being able to check that the error matches the reason you expect is really valuable for writing tests, both internally and externally.
It looks like your PR is a breaking change, but you didn't provide a migration guide. Could you add some context on what users should update when this change get released in a new version of Bevy? |
I ran localy |
Sorry for unnecessary pinging, looks like we are waiting for #12730 |
@alice-i-cecile I made some changes after your review. And now all checks have passed. I hope you will find time for a feedback. |
|
||
impl PartialEq for AssetLoaderError { | ||
#[inline] | ||
fn eq(&self, other: &Self) -> bool { |
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 call out in a doc string for this implementation that we're only comparing the TypeId
of the underlying error.
This is somewhat surprising, so we should mention it to save people time when debugging.
Two small notes, but we're almost there :) |
f243e36
to
d6761ed
Compare
@alice-i-cecile this PR is ready for your review |
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.
Thank you very much!
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.
I'm on board for this!
…tes for not full equality checks
d6761ed
to
b75a8e6
Compare
Thank you to everyone involved with the authoring or reviewing of this PR! This work is relatively important and needs release notes! Head over to bevyengine/bevy-website#1297 if you'd like to help out. |
Objective
Fixes #12667.
Solution
Migration guide
Added AssetLoadError to LoadState::Failed option
Removed
Copy
,Ord
andPartialOrd
implementations for LoadState enumAdded
Eq
andPartialEq
implementations for MissingAssetSourceError, MissingProcessedAssetReaderError, DeserializeMetaError, LoadState, AssetLoadError, MissingAssetLoaderForTypeNameError and MissingAssetLoaderForTypeIdError