feat: log the reason a request failed when errors are not fatal - #666
Conversation
The step continues by default when a request fails, but nothing was written to the log, so a misconfigured token or an invalid payload gave no feedback at all. Warn with the reason instead, and point at the "errors" input for workflows that want the step to fail. Closes slackapi#502
🦋 Changeset detectedLatest commit: 5781fa3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #666 +/- ##
=======================================
Coverage 99.86% 99.86%
=======================================
Files 8 8
Lines 731 732 +1
=======================================
+ Hits 730 731 +1
Misses 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
zimeg
left a comment
There was a problem hiding this comment.
@deepunyk Thank you for bringing this issue to a PR! I made a few changes before we merge this, and am hoping to include a few others before it's released:
📚 In warning output I'm avoiding recommendations to change the value of "errors" because this might be intentionally set. Instead we can follow up to documentation improvements to highlight this more if needed!
Otherwise I think this is a nice set of focused changes! 🚀
Co-authored-by: Eden Zimbelman <zim@o526.net>
Summary
Closes #502.
The
errorsoption defaults tofalseso a failed request does not fail the step. Nothing was written to the log either, so a workflow with a mistyped token or an invalid payload finished green with no output at all and no hint about what went wrong. The reason was only reachable by adding a follow-up step that echoed theresponseoutput.This logs a warning with the reason instead, and mentions the
errorsinput for workflows that do want the step to fail. Theokandresponseoutputs are unchanged, anderrors: truestill fails the step with an error annotation rather than a warning.Preview
An invalid token with the default options:
Testing
Three tests are added to the existing
sendspecifications, since this is where theerrorsoption is handled:errors: true, which fails the step insteadRequirements