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

@GraphQlExceptionHandler method fails with "No registration for controller type" message if controller has proxy #710

Closed
Marthym opened this issue May 28, 2023 · 1 comment
Assignees
Labels
type: bug A general bug
Milestone

Comments

@Marthym
Copy link

Marthym commented May 28, 2023

Hi,

I get this error when my controller return an exception : No registration for controller type: MyGqlController$$SpringCGLIB$$0
In this error we can see $$SpringCGLIB$$0 at the end of the class name and it should be the reason for this message.

In my controller I have

    @MutationMapping
    public Mono<Object> testMethod() {
        return Mono.error(new NoSessionException("User is not logged on !"));
    }

    @GraphQlExceptionHandler
    public GraphQLError handle(NoSessionException ex) {
        return GraphqlErrorException.newErrorException()
                .message(ex.getLocalizedMessage())
                .errorClassification(ErrorType.NOT_FOUND)
                .build();
    }

In the AnnotatedControllerExceptionResolver , in resolveException the this.controllerCache key was the original class name, not the proxy class name. So the controller (proxy) class was not found in controllerCache.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 28, 2023
@rstoyanchev rstoyanchev self-assigned this May 31, 2023
@rstoyanchev rstoyanchev added this to the 1.2.1 milestone May 31, 2023
@rstoyanchev rstoyanchev added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels May 31, 2023
@rstoyanchev rstoyanchev changed the title No registration for controller type: MyGqlController$$SpringCGLIB$$0 @GraphQlExceptionHandler method fails with "No registration for controller type" message if controller has proxy May 31, 2023
@rstoyanchev rstoyanchev changed the title @GraphQlExceptionHandler method fails with "No registration for controller type" message if controller has proxy @GraphQlExceptionHandler method fails with "No registration for controller type" message if controller has proxy May 31, 2023
@rstoyanchev
Copy link
Contributor

Thanks for reporting the issue. There is a fix now in 1.2.1-SNAPSHOT, if you want to give that a try and confirm that it does work for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants