Skip to content

The timeout behavior in Mono.block(timeout) #3519

@anuchandy

Description

@anuchandy

The Mono.block(timeout) API throws an "IllegalStateException" with the error text "Timeout on blocking read for ..." when the timeout expires.

I wonder if it should instead throw "TimeoutException"? This is how typical Java blocking APIs behave - for example CompletableFuture.get(timeout) reference.

Is it possible to address this? The "IllegalStateException" exception is so generic that it's impossible to distinguish when an API that takes timeout throws this for timeout reasons.

Or at least the "IllegalStateException" with cause as TimeoutException. But I think for the ease of use, the users are likely to prefer direct throwing of "TimeoutException" instead of catching "IllegalStateException" and unwrapping the cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    for/stackoverflowQuestions are best asked on SO or Gitter

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions