Skip to content

Conversation

@nabijaczleweli
Copy link

$ git grep AllAttemptsErrored
src/client.rs:                        return Err(Error::AllAttemptsErrored(errors));
src/client.rs:                                        return Err(Error::AllAttemptsErrored(errors));

fixed here

src/raw_client.rs:    Err(Error::AllAttemptsErrored(errors))

already correctly collected

src/types.rs:    AllAttemptsErrored(Vec<Error>),
src/types.rs:            Error::AllAttemptsErrored(errors) => {

consumers

Closes #186

Copy link
Contributor

@ValuedMammal ValuedMammal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK, however you still have unwrap in your code which isn't great. Maybe it will be better to log the warning first before placing the error into the errors vec.

  $ git grep AllAttemptsErrored
  src/client.rs:                        return Err(Error::AllAttemptsErrored(errors));
  src/client.rs:                                        return Err(Error::AllAttemptsErrored(errors));
fixed here
  src/raw_client.rs:    Err(Error::AllAttemptsErrored(errors))
already correctly collected
  src/types.rs:    AllAttemptsErrored(Vec<Error>),
  src/types.rs:            Error::AllAttemptsErrored(errors) => {
consumers

Closes bitcoindevkit#186
@nabijaczleweli
Copy link
Author

nabijaczleweli commented Dec 7, 2025 via email

@ValuedMammal
Copy link
Contributor

In 59c28bd: Include latest error in AllAttemptsErrored

I understand that we can expect errors to be non-empty after pushing an error into it, however this code is dangerous and error prone due to the unchecked container access. The only time e is used outside of the errors vector is to pass a reference to the warn! macro, so it'd arguably be better to log the warning first before moving the value into errors. This is the suggestion I tried to convey in an earlier comment #188 (review).

Please also include a PR description that others can make sense of, and consider using conventional commits. Thanks for your contribution. @nabijaczleweli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Routinely returns AllAttemptsErrored([]) on failed requests

2 participants