Skip to content
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

Rewrite send::error::ResponseError docs #307

Merged
merged 2 commits into from
Jul 1, 2024

Conversation

jbesraa
Copy link
Collaborator

@jbesraa jbesraa commented Jun 27, 2024

noticed the docs are kind of bad while reviewing #304

resolves #306

Copy link
Contributor

@DanGould DanGould left a comment

Choose a reason for hiding this comment

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

Helpful changes. Thanks!

Can you be more specific with your issue however? What do you mean when you say documentation is "kind of bad"

Comment on lines 274 to 278
/// `WellKnown` errors following the BIP78 spec
/// https://github.com/bitcoin/bips/blob/master/bip-0078.mediawiki#user-content-Receivers_well_known_errors
/// These errors are displayed to end users.
/// Errors that are defined in the [`BIP78`] spec.
///
/// The `WellKnownError` represents `errorCode` and `message`.
/// It is safe to display these errors to end users.
///
/// [`BIP78`]: https://github.com/bitcoin/bips/blob/master/bip-0078.mediawiki#user-content-Receivers_well_known_errors
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer that the original explicitly said "WellKnown errors". There are lots of errors defined in the bip78 spec, these are explicitly called "Well-known" errors

I do also prefer your wording "It is safe to display these errors to end users."

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.
I was looking into the spec and could not find another errors, could you be please share a link to errors beside the ReceiverWellKnown ?

Comment on lines 280 to 284
/// `Unrecognized` errors are errors that are not well known and are only displayed in debug logs.
/// They are not displayed to end users.
/// Errors out of the scope of the [`BIP78`] spec.
///
/// These errors are only displayed in debug logs.
///
/// [`BIP78`]: https://github.com/bitcoin/bips/blob/master/bip-0078.mediawiki#user-content-Receivers_well_known_errors
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer the original first sentence. It would be good for this to mirror the first change you made

"They are not displayed to end users." -> "Unrecognized errors are not safe to display to end users because they could be used maliciously to phish a non technical user. Only display them in debug logs."

Adding the link is a great idea.

/// They are only displayed in debug logs.
/// Errors caused by malformed responses.
///
/// These errors are only displayed in debug logs.
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment change is fine but "These errors are only displayed in debug logs" is false statement impl Display for ResponseError writes the ValidationError in the match arm for ResponseError::Validation

Consider fixing the Display implementation to only write a fixed string.

Self::Validation(e) => write!(f, "The receiver sent an invalid response: {}", e),

@jbesraa jbesraa force-pushed the 2024-06-26-response-error-docs branch 2 times, most recently from 9bf956c to 4a29240 Compare July 1, 2024 15:02
@jbesraa jbesraa force-pushed the 2024-06-26-response-error-docs branch from 4a29240 to 68c2e4f Compare July 1, 2024 15:07
@jbesraa
Copy link
Collaborator Author

jbesraa commented Jul 1, 2024

@DanGould revisited issue body plus addressed your comments and added new commit to resolve the Validation printing in Display

Copy link
Contributor

@DanGould DanGould left a comment

Choose a reason for hiding this comment

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

Thank you. So much cleaner than before. Excellent.

/// `WellKnown` errors following the BIP78 spec
/// https://github.com/bitcoin/bips/blob/master/bip-0078.mediawiki#user-content-Receivers_well_known_errors
/// These errors are displayed to end users.
/// `WellKnown` Errors are defined in the [`BIP78::ReceiverWellKnownError`] spec.
Copy link
Contributor

Choose a reason for hiding this comment

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

I find the use of :: to identify the receiver spec a bit odd since it's not referencing a rust module element but it does get the point across

@DanGould DanGould merged commit 2d45fd4 into payjoin:master Jul 1, 2024
4 checks passed
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.

rewrite ResponseError docs
2 participants