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

Enable use of ? in Endpoint #438

Merged
merged 7 commits into from
Apr 20, 2020
Merged

Enable use of ? in Endpoint #438

merged 7 commits into from
Apr 20, 2020

Conversation

yoshuawuyts
Copy link
Member

This PR makes each endpoint return a tide::Result (alias for http_types::Result) which allows the ? operator to work on all endpoints. Effectively this will make unwrap no longer necessary, and will significantly improve our error handling story.

Closes #138 #371 #389.

Example

The Tide "hello world" example now looks like this:

let mut app = tide::new();
app.at("/").get(|_| async { Ok("hello world") });
app.listen("localhost:8080").await?;

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

Successfully merging this pull request may close these issues.

Handling Errors in Route Handlers
1 participant