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

structured errors for connection failures #4819

Open
vjeffrey opened this issue Nov 5, 2024 · 0 comments
Open

structured errors for connection failures #4819

vjeffrey opened this issue Nov 5, 2024 · 0 comments

Comments

@vjeffrey
Copy link
Contributor

vjeffrey commented Nov 5, 2024

In order to better consume the errors produced by cnquery/cnspec during scans, we need to start structuring these errors a bit more.
Specifically, we need to identify when an error is an auth-based error vs some other scan error.
This will help all consumers of cnquery to more appropriately respond to errors through automated systems.

example:
cnspec scan aws
-> results in auth error bc missing or expired creds

as an example, we could read the error and ensure the statusCode aligns to what we all expect/agree on to signify an auth error (401/403)

type cnqueryError struct {
statusCode int32
message string
}

the consumer of the error could then send a better message to the user about what went wrong/wrap the error message in a helpful way in automated scenarios

things to consider:

  • this work is provider-specific
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant