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

improve error message for 404 errors whilst querying Terraform Cloud … #626

Merged
merged 3 commits into from
Apr 13, 2021

Conversation

ansgarm
Copy link
Member

@ansgarm ansgarm commented Apr 12, 2021

…workspace

Before:
Screenshot 2021-04-12 at 15 28 54

After:
Screenshot 2021-04-12 at 15 28 18

@ansgarm
Copy link
Member Author

ansgarm commented Apr 12, 2021

@skorfmann in #488 you mentioned also handling other possible errors. Do you have some example of how to reproduce some?
The response seems to contain some well formed error object which could be printed if any 4xx or 5xx error happens.
Unfortunately it does not differentiate whether the organizationName or workspace caused the 404 so the wording of the error message states both at possibly incorrect.

Copy link
Contributor

@skorfmann skorfmann left a comment

Choose a reason for hiding this comment

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

Looks good - let's keep it simple and get it merged 👍

…form Cloud

it seems that the structure of an error returned from the api differs between endpoints (e.g. a POST to workspaces returns an error object with four properties while a GET at a different request only returns two properties in the object of an error), hence we just print the whole error object for the time being
@ansgarm ansgarm requested a review from skorfmann April 12, 2021 16:17
@ansgarm
Copy link
Member Author

ansgarm commented Apr 12, 2021

Example for printing the whole error object because its structure differs between endpoints / methods:
Screenshot 2021-04-12 at 18 11 37

@skorfmann
Copy link
Contributor

Cool - let's ship it 👍

@ansgarm ansgarm merged commit d9d6546 into main Apr 13, 2021
@ansgarm ansgarm deleted the ansgarm/issue488 branch April 13, 2021 07:12
@github-actions
Copy link
Contributor

I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants