-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Cleaned up panic messages #8219
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
c40baa7
Cleaned up panic messages
JonahPlusPlus 8bbf8b2
Condensed message
JonahPlusPlus 64d2d14
Added returns and messages to exclusive systems
JonahPlusPlus 9848db5
Fix typo
JonahPlusPlus ff26969
Propagate errors in systems
JonahPlusPlus c8e5a81
Allow unfinished systems to complete
JonahPlusPlus dfc0dd7
Fixed issue in bevy_tasks + formatted code
JonahPlusPlus 7cdffdb
Fix recursive dependencies
JonahPlusPlus acf45fd
Moved checks to function
JonahPlusPlus ec4e3dd
Fix typo
JonahPlusPlus 6eb96b1
Fix typo
JonahPlusPlus 9484d9c
Replaced `println!` with `error!`
JonahPlusPlus 63a1496
Replaced `error!` with `eprintln!`
JonahPlusPlus 90ab514
Merge remote-tracking branch 'upstream/main' into better_panics
JonahPlusPlus 5eec1b6
Executor allows running systems to complete
JonahPlusPlus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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's a bit too late now, but in a future PR something like this could make the error stand out a bit more
This will make the ERROR red and look like this:
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.
is this supported in all terminals on all platforms?
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 know it works on windows at least and I would be surprised if it didn't work on linux. but I don't have a way to confirm it right now. There are crates that can handle that more gracefully though, just not sure if adding a crate just for that is required, although, tracing probably already uses one of them so we could just reuse that one since it's already in the dep tree.
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.
And when logs are redirected to a file? I don't know of a single way to have colors...
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 could use
error!
macro to have colors in terminal and normal output if colors aren't supported.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.
error!
wasn't used because of verbosity concerns. I don't personally agree, but I suggested that approach as an alternative. I think we should instead change the default format of logs if the verbosity is a concern instead of avoiding it, but that's out of scope for here.True, I didn't really consider that. At least it would just be a couple of weird characters at the end of the file, but it's indeed not ideal.
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 to me.
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.
Well, there's
error!()
that can deal with it correctly 😉. So it's a way, but like mentioned it was purposefully not used.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 meant by adding control characters. As far as I know the tracing library is using environment detection.
Oh I thought it was because
bevy_ecs
can be used without logs and tracing enabledThere 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.
Right, I was basing it on this comment #8219 (comment) but alice mentioned just after that that it won't work with tracing disabled.
Not sure what the best solution is, maybe we could just use a feature flag for tracing and if it's disabled just use the current log with no color?
It jus seems unfortunate to not use tracing where possible. For example, if someone sets up a tracing layer to output to a file they won't get those logs currently, which really isn't ideal.