Write a better error message when secret not found#182
Conversation
cbd20bc to
7dc1ddf
Compare
|
@jasonodonnell ping pong :) |
| } catch (error) { | ||
| const {response} = error; | ||
| if (response.statusCode === 404) { | ||
| throw Error(`Unable to retrieve result for "${path}". Double check your Key.`) |
There was a problem hiding this comment.
| throw Error(`Unable to retrieve result for "${path}". Double check your Key.`) | |
| throw Error(`Unable to retrieve result for "${path}".`) |
There was a problem hiding this comment.
Removing key because it may be due to other things (token perms, connectivity, etc).
| secret/data/test secret | NAMED_SECRET ; | ||
| secret/data/notFound kehe | NO_SIR ;`); | ||
|
|
||
| expect(exportSecrets()).rejects.toEqual(Error(`Unable to retrieve result for "secret/data/notFound". Double check your Key.`)); |
There was a problem hiding this comment.
| expect(exportSecrets()).rejects.toEqual(Error(`Unable to retrieve result for "secret/data/notFound". Double check your Key.`)); | |
| expect(exportSecrets()).rejects.toEqual(Error(`Unable to retrieve result for "secret/data/notFound".`)); |
|
This would be nice to have, see also |
|
Hi everyone, it would be great if this could be merged. It would be super helpful to see right away what causes the error. |
|
@simonjohansson we've walk through a few scenarios on both making API calls directly and via the CLI that results in errors, and think that there's value in returning the request path as well as the error itself. API CLI Could you update the PR such that when the error is caught, the |
|
@calvn Howdie. I don't work in the company where we used the action anymore. So I wont have any time/setup to expand the PR. |
This is a follow-up PR to #182 to address additional comments.
|
Thanks @simonjohansson. I'll go ahead and close this one in favor of #306 so that we can address these comments. I've left your commit in so that you still get credit for it. |
* Write a better error message when key not found * Address additional comments on #182 Co-authored-by: Simon Johansson <simon@simonjohansson.com>
Currently when a secret is not found we get an error message
If you have multiple secrets it can be tedious to figure out which secret is missing.
This PR fixes that by giving the error message