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

Filter::or with a filter's error of Never should also have Never as error #109

Closed
seanmonstar opened this issue Oct 3, 2018 · 0 comments · Fixed by #310
Closed

Filter::or with a filter's error of Never should also have Never as error #109

seanmonstar opened this issue Oct 3, 2018 · 0 comments · Fixed by #310
Milestone

Comments

@seanmonstar
Copy link
Owner

seanmonstar commented Oct 3, 2018

If you chain 2 filters with an or, and the latter one can never fail, it is clear that the chained filter likewise can never fail. However, this is currently not true:

fn v1() -> impl Filter<Extract=(Option<u32>,), Error=Rejection> {
    warp::path::param::<u32>()
        .map(Some)
        .or(warp::any().map(|| None))
}

It should be like this:

fn v1() -> impl Filter<Extract=(Option<u32>,), Error=Never> {
    warp::path::param::<u32>()
        .map(Some)
        .or(warp::any().map(|| None))
}

I've made changes locally that makes this work, by modifying CombineRejection, but I suspect this change may subtly break some people...

@seanmonstar seanmonstar added this to the 0.2 milestone Oct 3, 2018
masonforest pushed a commit to masonforest/warp that referenced this issue Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant