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

fix: don't log success on error #435

Merged
merged 2 commits into from
Dec 11, 2019
Merged

Conversation

wwilsman
Copy link
Contributor

Purpose

Even if the finalize request fails, we currently print a finalized build message (which is not true)

Approach

@Robdel12 did the fix, I added a test and sent the error to stderr rather than stdout.

Previously, we were catching a promise and then logging "successfully." Since the promise thinks the error is "handled" it allows execution to continue. Moving catch to be after then rather than before will correctly log on a successful response only. Also, rather than mixing async/await and then/catch, this change strictly sticks to async/await (and uses a try/catch block instead of promise methods).

Robdel12 and others added 2 commits December 11, 2019 11:54
It pains me to push this up without a failing test 😢
Adds a test to verify that the error is logged to stderr and that the finalize
log is not present due to the error
@wwilsman wwilsman requested a review from Robdel12 December 11, 2019 20:43
Copy link
Contributor Author

@wwilsman wwilsman left a comment

Choose a reason for hiding this comment

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

I can't approve parts of my own PR, but I do approve the parts that @Robdel12 did.

🎮

Copy link
Contributor

@Robdel12 Robdel12 left a comment

Choose a reason for hiding this comment

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

🏁 Very nice!

@wwilsman wwilsman merged commit 84ac23f into master Dec 11, 2019
@wwilsman wwilsman deleted the rd/dont-log-success-on-error branch December 11, 2019 20:47
await this.percyClient.finalizeBuild(this.buildId)
this.logEvent('finalized')
} catch (err) {
logError(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add some context here.. Perhaps a log line above this logError that says Error during build finalize: or something similar.

djones pushed a commit that referenced this pull request Dec 11, 2019
## [0.20.4](v0.20.3...v0.20.4) (2019-12-11)

### Bug Fixes

* don't log success on error ([#435](#435)) ([84ac23f](84ac23f))
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.

3 participants