Skip to content

Improve error handling around gh api#79

Merged
emmatyping merged 2 commits into
getsentry:mainfrom
mislav:patch-1
Jul 6, 2022
Merged

Improve error handling around gh api#79
emmatyping merged 2 commits into
getsentry:mainfrom
mislav:patch-1

Conversation

@mislav
Copy link
Copy Markdown
Contributor

@mislav mislav commented Feb 15, 2022

Explicitly handle error statuses from gh api instead of detecting error conditions by inspecting the first character of the output. It is not guaranteed that the first character of an errored gh api response is {, but it's definitely guaranteed that in case of HTTP 4xx–5xx responses, gh api will exit with a nonzero status. This approaches uses the failing status to blank out the mention_slug variable, which I find to be less hacky and more future-proof.

Additionally, this avoids GitHub Actions workflow interpolation ${{...}} embedded in bash script and instead passes in variables as environment variables. The bash script may fail after expanding these placeholders if any of the expanded value contains characters like "'${}! or similar characters that have special meaning in bash. Passing in environment variables, on the other hand, is safe regardless of the value.

Followup to #78. Untested. Feel free to discard ✌️ /cc @chadwhitacre

Ref. cli/cli#5209

@chadwhitacre
Copy link
Copy Markdown
Contributor

Hah! Thanks so much @mislav! I will try this out and try my best to accept the patch. 😁 ❤️

@github-actions
Copy link
Copy Markdown

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@emmatyping emmatyping merged commit 33e9bef into getsentry:main Jul 6, 2022
@emmatyping
Copy link
Copy Markdown

Thanks again @mislav ! We appreciate the PR :)

@mislav mislav deleted the patch-1 branch July 9, 2022 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants