cryostatio / cryostat-web

Web front-end for Cryostat: Secure JDK Flight Recorder management for containerized JVMs
https://cryostat.io/
Other
10 stars 20 forks source link

feat(graphql): improve error handling #1295

Open Josh-Matsuoka opened 2 weeks ago

Josh-Matsuoka commented 2 weeks ago

Addresses https://github.com/cryostatio/cryostat/issues/394

Currently when graphQL queries fail due to missing SSL configuration or authentication failure the Web UI can't handle them correctly because they aren't throw in the traditional way. Rather than generating a 427 or 502 and accompanying HttpException they're instead masked by GraphQL and return a 200 but with a special response.

This response takes the form of an error object with various fields determined by the error handling configuration on the server. The accompanying cryostat3 PR changes this configuration to give us a form we can work with to determine the cause of the error and deal with it accordingly. With the server correctly configured this gives us the underlying exception and message, and the graphQL error classification (i.e. DataFetchingError).

This PR updates the graphQL queries and surrounding error handling to account for errors correctly and set the auth/ssl failure flags on the target accordingly.