Skip to content

cloud,ccl: fix improperly wrapped errors#72349

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
rafiss:fix-ccl-errwrap
Nov 16, 2021
Merged

cloud,ccl: fix improperly wrapped errors#72349
craig[bot] merged 1 commit intocockroachdb:masterfrom
rafiss:fix-ccl-errwrap

Conversation

@rafiss
Copy link
Copy Markdown
Collaborator

@rafiss rafiss commented Nov 2, 2021

refs #42510

I'm working on a linter that detects errors that are not wrapped
correctly, and it discovered these.

Release note: None

@rafiss rafiss requested a review from a team November 2, 2021 20:43
@rafiss rafiss requested a review from a team as a code owner November 2, 2021 20:43
@rafiss rafiss requested review from stevendanna and removed request for a team November 2, 2021 20:43
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@rafiss rafiss changed the title ccl/*: fix improperly wrapped errors cloud,ccl: fix improperly wrapped errors Nov 2, 2021
@rafiss rafiss force-pushed the fix-ccl-errwrap branch 2 times, most recently from 2001621 to cdede82 Compare November 3, 2021 21:56
@rafiss rafiss requested review from a team and stevendanna and removed request for stevendanna November 4, 2021 16:07
err := errors.Errorf("error response from server: %s %q", resp.Status, body)
if err != nil && resp.StatusCode == 404 {
err = errors.Wrapf(cloud.ErrFileDoesNotExist, "http storage file does not exist: %s", err.Error())
err = errors.WithDetailf(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm. So here/elsewhere in the cloud errors, I'm wondering if we want to move this to the hint instead of keeping it in the main error text? If my recollection is correct, some/most client libraries only default to the main error text, so if we change this, do we risk having support requests where a user comes back to us with "hey, our backup airflow job failed with 'pq: object does not exist'" without the actual error we got from the request?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

hm, yeah, if the other error's text is considered critical info in order to be able to debug the problem, then it makes more sense to put it in the main text.

@otan otan removed the request for review from a team November 11, 2021 21:59
@rafiss rafiss requested a review from dt November 12, 2021 19:44
@rafiss
Copy link
Copy Markdown
Collaborator Author

rafiss commented Nov 12, 2021

This is ready for another review

I'm working on a linter that detects errors that are not wrapped
correctly, and it discovered these.

Release note: None
@rafiss rafiss requested a review from a team as a code owner November 15, 2021 20:42
Copy link
Copy Markdown
Contributor

@HonoreDB HonoreDB left a comment

Choose a reason for hiding this comment

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

Changefeed test helper change :lgtm:

Reviewed 1 of 14 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @dt and @stevendanna)

@rafiss
Copy link
Copy Markdown
Collaborator Author

rafiss commented Nov 16, 2021

tftr! gonna go ahead and merge since the CI failure is from a timezone test that has since been fixed

bors r=HonoreDB

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Nov 16, 2021

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Nov 16, 2021

Build succeeded:

@craig craig bot merged commit 525322a into cockroachdb:master Nov 16, 2021
@rafiss rafiss deleted the fix-ccl-errwrap branch November 17, 2021 06:07
craig bot pushed a commit that referenced this pull request Dec 15, 2021
71877: lint: add new errwrap linter r=ajwerner,knz a=rafiss

fixes #42510

This linter checks if we don't correctly wrap errors.

The `/* nolint:errwrap */` comment can be used to disable the linter inline.

See individual commits for mistakes this linter caught.
It had already caught a few in #72353, #72352, #72351, #72350, and #72349.

Release note: None

Co-authored-by: Rafi Shamim <rafi@cockroachlabs.com>
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.

4 participants