context.LastErrorproperty and can be used by policies in the on-error policy section. This article provides a reference for the error handling capabilities in API management.
on-errorsections as shown in the following example.
UserInputError, and a generic
ApolloError. These errors are designed to enhance errors thrown before and during GraphQL execution, making it easier to debug your Apollo Server integration and enabling clients to take specific actions based on an error.
errorsarray contains an
extensionsobject that contains the information added by Apollo Server.
err.statusor by default 500. If
err.exposeis true, then
err.messagewill be the reply. Otherwise, a message generated from the error code will be used (e.g. for the code 500, the message "Internal Server Error" will be used). All headers will be cleared from the request, but any headers in
err.headerswill then be set. You can use a try-catch, as specified above, to add a header to this list.