Skip to content

[Doc] recover and recoverWith overview needs more differentiation #2297

@plouj

Description

@plouj

Right now

The `recoverWith` combinator creates a new future which holds the
starts the same for both recover and recoverWith:

The recover combinator creates a new future which holds the same result as the original future if it completed successfully

vs

The recoverWith combinator creates a new future which holds the same result as the original future if it completed successfully

which is rather confusing to beginners.

The first real differentiation appears in the middle of the paragraphs:

If it maps the Throwable to some value, then the new future is successfully completed with that value.

vs

If it maps the Throwable to some future, then this future is completed with the result of that future.

which took me a while to find and I personally struggled to parse because I couldn't tell if there is a typo somewhere of text is precisely correct and needs to be interpreted as such.

Assuming the text is correct, perhaps it would help if the first sentence of the second paragraph would say something like:

The recoverWith combinator also creates a new future which ...

and later on in the same paragraph, something like

If it maps the Throwable to some future, then, unlike what happens with recover, this future is completed with the result of that future.

Or perhaps someone can come up with a much more clear wording than I can :) https://stackoverflow.com/a/36585703/1517753 ?

Thank you for this documentation!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions