LukeMathWalker / zero-to-production

Code for "Zero To Production In Rust", a book on API development using Rust.
https://www.zero2prod.com
Apache License 2.0
5.43k stars 470 forks source link

Error output doesn't match with the book in chapter 8.2 #241

Closed chdalski closed 5 months ago

chdalski commented 5 months ago

In Chapter 8.2 the log output from the first test (subscribe_fails_if_there_is_a_fatal_database_error()) at the beginning of the chapter should contain:

ERROR: [HTTP REQUEST - EVENT] Error encountered while 
        processing the incoming HTTP request: "" 
    exception.details="",
    exception.message="",
    target=tracing_actix_web::middleware
 INFO: [HTTP REQUEST - END] 
    exception.details="",
    exception.message="",
    target=tracing_actix_web::root_span_builder, 
    http.status_code=500

However the output doesn't match with the output console output - the [HTTP REQUEST - EVENT] is missing completely and the exception.details and exception.message aren't shown in [HTTP REQUEST - END].

How to replicate:

I might miss something but I can't figure it out and help would be very much appreciated.

chdalski commented 5 months ago

Chapter 8.2.1 implements the StoreTokenError and forwards it to actix_web::Error. The expected output ([HTTP REQUEST - EVENT]) is available after the implementation.

So the issue is resolved by actually forwarding the errors to actix_web. The output will not contain the exception.details and exception.message without that mechanism in place.

So I guess it's documented now and I'll close the issue.