Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

No location, path, extensions When graphql.servlet.exception-handlers-enabled Set to true #478

Closed
@ryandanielspmc

Description

@ryandanielspmc

Version: 8.0.0

When graphql.servlet.exception-handlers-enabled is set to true, validation errors do not contain location, path, or extensions. This is true with and with out @ExceptionHandlers. In this scenario, my validation error is passing an integer to a parameter that requires a string.

When I set graphql.servlet.exception-handlers-enabled to false, location, path, and extensions appear normally in the results for validation errors.

As a test, I made my application throw an IllegalArgumentException and it was correctly picked up by my error handler and contained location, path, and extensions.

For reference, here is my error handler:

@Component
class ExceptionHandler {
    @ExceptionHandler(Exception::class)
    fun handleGeneric(ex: Exception, errorContext: ErrorContext): GraphQLError =
        processGenericException(ex, errorContext)

    private fun processGenericException(ex: Throwable, errorContext: ErrorContext): GraphQLError =
        GraphqlErrorBuilder.newError()
            .message(ex.message)
            .locations(errorContext.locations.orEmpty())
            .path(errorContext.path.orEmpty())
            .extensions(errorContext.extensions.orEmpty())
            .build()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions