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

safe details/messages: clarify cases with empty formats #3

Merged
merged 3 commits into from
Jul 9, 2019

Conversation

knz
Copy link
Contributor

@knz knz commented Jul 9, 2019

  • when format is empty but there are additional arguments, still
    perform the formatting (the values will be included)
  • when format is empty and there are no additional argument,
    make the safe detail wrapper present itself as "empty"
    during %+v formatting
  • additionally a new primitive HandleAsAssertionFailure() to avoid NewAssertionErrorWithWrappedErrf(err, "") and a surprising empty string.

This change is Reviewable

- when format is empty but there are additional arguments, still
  perform the formatting (the values will be included)
- when format is empty and there are no additional argument,
  make the safe detail wrapper present itself as "empty"
  during `%+v` formatting
Copy link
Member

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

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

:lgtm: Thanks!

Reviewed 3 of 4 files at r1, 2 of 3 files at r2, 3 of 3 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @knz)


errutil_api.go, line 113 at r2 (raw file):

}

// HandleAsAssertionFailureDepth

[nit] forwards a definition.

knz added 2 commits July 9, 2019 15:16
... this can be used instead of `NewAssertionErrorWithWrappedErr(err,
"")` to avoid the surprising/unclear empty string argument.
Before:

```
some error
- original cause behind barrier:
  original message
  - original details
```

After:

```
some error
- original cause behind barrier: original message
  - original details
```

Suggested by @RaduBerinde.
Copy link
Contributor Author

@knz knz left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


errutil_api.go, line 113 at r2 (raw file):

Previously, RaduBerinde wrote…

[nit] forwards a definition.

Done

@knz knz merged commit 7ba395a into cockroachdb:master Jul 9, 2019
@knz knz deleted the 20190709-fmt branch July 9, 2019 13:18
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.

2 participants