sensu / sensu-aggregate-check

The Sensu Go Aggregate Check Plugin
MIT License
0 stars 8 forks source link

Error handling for bad api calls #13

Closed Blue0ctober closed 4 years ago

Blue0ctober commented 4 years ago

When passing bad configurations, the errors returned are not helpful. This may be due to error handling from responses coming from the api.

As an example configuring --api-pass=notthecorrectpassword will return in my use case:

Error executing sensu-aggregate-check: error executing check: invalid character 'U' looking for beginning of value

While configured with the correct password the check works correctly.

nixwiz commented 4 years ago

The 'U' is because it's expecting a JSON response back with the access token, but is instead getting only the text 'Unauthorized'.

We can definitely add something to at least catch that and surface it better.