Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ktor Feature: Exceptions throw in a DataProperty loader or accessRule are not caught #169

Open
zypus opened this issue Oct 24, 2021 · 0 comments

Comments

@zypus
Copy link

zypus commented Oct 24, 2021

Exceptions throw in a DataProperty loader or accessRule are not caught if wrapError = true is set. Instead they bubble up to the application level.

As I'm not sure where the best place would be to do the catching I didn't open a pull request. However in my tests I had to wrap the call as far up as the DefaultSchema in order to catch the exceptions.

try {
    executor.suspendExecute(
        plan = requestInterpreter.createExecutionPlan(document, parsedVariables, options),
        variables = parsedVariables,
        context = context
    )
} catch (e: Exception) {
    if (configuration.wrapErrors && e !is GraphQLError) {
        throw GraphQLError(e.message ?: "", nodes = listOf(), originalError = e)
    } else throw e
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant