Skip to content

Checked Exception in field resolver results in UndeclaredThrowableExceptions #477

@apae89

Description

@apae89

Description

Hi,

I'm not quite sure if it's a bug, but I found a strange behavior after updating to version 6.1.0.
Since this version checked exceptions thrown in field resolver functions are getting wrapped by an UndeclaredThrowableException.
The corresponding change came with this commit: 950e291

Is there any particular reason for this implementation?

According to Oracle's documentation such an exception should only be thrown if a method throws a checked exception in its body that is not declared in the method's signature.

Expected behavior

Checked exceptions are not getting wrapped by an UndeclaredThrowableException, but only thrown as RuntimeExceptions and Errors.

Actual behavior

Checked exceptions are are getting wrapped by an UndeclaredThrowableException.

Steps to reproduce the bug

  1. Define a query in the GQL scheme
type Query {
    testQuery: String
}
  1. Implement a corresponding resolver function and throw a checked Exception
    public String testQuery() throws Exception {
        throw new Exception();
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions