The various layers of web services make error handling tricky, even without security requirements: what to communicate and when? Should an error bubble up only to be handled at the last minute or earlier? What about cascades? In this recipe, we will uncover some options to do that elegantly in actix-web.
Web error handling
Getting ready
Let's set up a Rust binary project using cargo new web-errors. Since we are going to serve stuff on the local port 8081, make sure that the port is accessible as well. Additionally, a program such as curl or Postman is required to test the web service.
Finally, open the entire directory with VS Code.