Prevent each from swallowing errors when eval_block returns a ListStream#12412
Merged
fdncred merged 2 commits intonushell:mainfrom May 1, 2024
Merged
Prevent each from swallowing errors when eval_block returns a ListStream#12412fdncred merged 2 commits intonushell:mainfrom
each from swallowing errors when eval_block returns a ListStream#12412fdncred merged 2 commits intonushell:mainfrom
Conversation
Contributor
|
Have you done any performance testing to see if this decreases the performance of table/each? |
Contributor
Author
|
Yes, there is a noticeable decrease in the performance of |
4721f45 to
0649d5b
Compare
each) from swallowing errorseach from swallowing errors when eval_block returns a ListStream
Contributor
Author
|
With this change, the performance decrease is minimised - only in the specific case where a |
WindSoilder
reviewed
Apr 19, 2024
| return Some(v.clone()); | ||
| } | ||
| } | ||
| Some(Value::list(vals, span)) |
Contributor
There was a problem hiding this comment.
Hmm...Maybe collect s first is not really good. What about this?
let mut vals = vec![];
for v in s {
if let Value::Error { .. } = v { return Some(v) }
else { vals.push(v) }
}
Some(Value::list(vals, span))
Contributor
Author
|
Rebased and accepted the suggestion. @fdncred @WindSoilder, take a look? |
Contributor
|
Thanks! It looks good to me. Since nushell will have a release in 5 days, I'd like to defer it after released |
WindSoilder
approved these changes
Apr 24, 2024
Contributor
|
Thanks |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Prior, it seemed that nested errors would not get detected and shown. This PR fixes that.
Resolves #10176:
Resolves #11224:
User-Facing Changes
Tests + Formatting
After Submitting