Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Handle wac template parse errors #271

Merged
merged 9 commits into from
Mar 9, 2021
Merged

Handle wac template parse errors #271

merged 9 commits into from
Mar 9, 2021

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Mar 8, 2021

Related to: https://github.com/cdr/m/pull/7373

In addition to the errors reported in the /m pr, this also now expands verbose errors. These verbose errors are not yet reviewed for human readability:

404 Repo

error: unexpected status code 500: An internal server error occurred.
  | read file: get file contents: GET https://api.github.com/repos/Emyrk/te/contents/.coder/coder.yaml?ref=master: 404 Not Found []

Empty Request

error: unexpected status code 500: An internal server error occurred.
  | parse repo url: unexpected url "", expecting at least an owner and a repo

Any server internal error

error: unexpected status code 500: An internal server error occurred.
  | exec select: pq: relation "images" does not exist

Comment on lines +35 to +36
cached *APIError
cachedErr error
Copy link
Member Author

Choose a reason for hiding this comment

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

We decode the re.Response.Body on .Error(). I didn't feel like trying to fix that behavior, but I need to cache the decoded payload as .Error() can be called more than once, and then the second one fails. So I split .Error() in to .Payload so I can extract the payload and not change any current behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh nice catch, I also think we had this buggy code duplicated in the monorepo. merged a patch there last week.

Copy link
Member Author

Choose a reason for hiding this comment

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

It still feels a little odd, but I didn't want to refactor how errors worked as I only touched small areas of the cli so far.
So this works for now.

@Emyrk Emyrk requested review from sreya and cmoog March 8, 2021 22:56
@Emyrk Emyrk marked this pull request as ready for review March 8, 2021 22:56
@Emyrk
Copy link
Member Author

Emyrk commented Mar 9, 2021

I'll merge when the /m PR gets merged: https://github.com/cdr/m/pull/7373

@Emyrk
Copy link
Member Author

Emyrk commented Mar 9, 2021

I broke some test making the errors better... I'll look into it :/

@Emyrk Emyrk force-pushed the stevenmasley/wac_errors branch from ddb9bae to fe5a60c Compare March 9, 2021 19:17
@Emyrk Emyrk merged commit df10559 into master Mar 9, 2021
@Emyrk Emyrk deleted the stevenmasley/wac_errors branch March 9, 2021 19:48
@Emyrk
Copy link
Member Author

Emyrk commented Mar 9, 2021

I realized this can be merged first, as I handle verbose errors better here too. So it works better against all release of /m

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.

2 participants