We have revamped the Graphql errors in Graphql standards, returning 200 response codes with errors as messages in response.
Old error codes:Currently the restructuring of graphql errors were done for the following error types:
In build errors:
ActiveRecord::RecordNotFound
ActiveRecord::RecordInvalid
ActiveRecord::StatementInvalid
ActiveRecord::RecordNotUnique
Custom errors:
EntityNotFound
InvalidRecord
All internal server errors(status code - 500) are also rescued and presented to the frontend. This particular response will include the rollbar id for the error to easily debug it.
The above-mentioned errors do go through Graphql API endpoints and are being rescued. There are two other scenarios where we check a few validations before the API endpoint is triggered. These errors are not rescued now and require infrastructure change which will also impact Rest endpoints. The following are those scenarios:
Invalid Account Type - This is used to determine which user can access which platform. Example scenario. YOP users should not be able to access EXPA.
Invalid Access Token - When the provided access token is invalid.
To fix the above two scenarios we will need to have an infrastructure update to Graphqh. We can take this forward in the future.
Note: The error codes which will remain the same are 401 and 406.
Sample Request & Response:
1. ActiveRecord::RecordNotFound:
Request: query getApplicationQuery { getApplication(id: 628134) { id } }