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

Annotating endpoints returning Flowable<> type with @ContinueSpan in case of any exception always throws ClassCastException #170

Open
Roodek opened this issue Sep 21, 2022 · 1 comment

Comments

@Roodek
Copy link

Roodek commented Sep 21, 2022

Expected Behavior

throwing expected exception 400 - Bad request

Actual Behaviour

adding @ContinueSpan annotation prevents the propagation of expected exception
throwing 500-internal Server Error instead

the thrown exception is
Unexpected error occurred: class io.micronaut.core.async.publisher.Publishers$JustThrowPublisher cannot be cast to class io.reactivex.Flowable (io.micronaut.core.async.publisher.Publishers$JustThrowPublisher and io.reactivex.Flowable are in unnamed module of loader 'app') java.lang.ClassCastException: class io.micronaut.core.async.publisher.Publishers$JustThrowPublisher cannot be cast to class io.reactivex.Flowable (io.micronaut.core.async.publisher.Publishers$JustThrowPublisher and io.reactivex.Flowable are in unnamed module of loader 'app')

is there a way to trace endpoints returning Flowable ?

Steps To Reproduce

  • Clone micronaut "Hello world" example project
  • Add endpoint returning Flowable<> type
@Controller("/hello") 
public class HelloController {
    @Get 
    @Produces(MediaType.TEXT_PLAIN) 
    public String index() {
        return "Hello World";
    }


    @Get("/err") 
    @ContinueSpan
    public Flowable<String> flowable() {
        try{
            throwException();
        }catch (Exception e){
            return Flowable.error(e);
        }
        return Flowable.just("example value");
    }

    private void throwException(){
        throw new HttpStatusException(HttpStatus.BAD_REQUEST,"wrong isolation");

    }
}
  • Call endpoint "/err"

Environment Information

JDK 11

Example Application

No response

Version

2.5.13, 3.6.3

@Roodek Roodek changed the title Annotating endpoints returning Flowable<> type in case of any exception always throws 500 Annotating endpoints returning Flowable<> type with @ContinueSpan in case of any exception always throws 500 Sep 21, 2022
@Roodek Roodek changed the title Annotating endpoints returning Flowable<> type with @ContinueSpan in case of any exception always throws 500 Annotating endpoints returning Flowable<> type with @ContinueSpan in case of any exception always throws ClassCastException Oct 10, 2022
@kalmar
Copy link

kalmar commented Oct 19, 2022

Have similar issue in my reactive app -- my async service annotated with @ContinueSpan just fails with:

java.lang.ClassCastException: class io.micronaut.core.async.publisher.Publishers$JustThrowPublisher cannot be cast to class reactor.core.publisher.Mono (io.micronaut.core.async.publisher.Publishers$JustThrowPublisher and reactor.core.publisher.Mono are in unnamed module of loader 'app')
	at ru.tinkoff.dwh.hercule.we.executor.$WorkspaceExecutorImpl$Definition$Intercepted.execute(Unknown Source)

Pls help!

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

2 participants