▲ | estebank 3 days ago | |||||||
Out of curiosity, why are you borrowing that many times? The following should work:
I would have written it this way
although if your crate defines `S3Error`, then I would prefer to write
by implementing `From`:
| ||||||||
▲ | dev_l1x_be 2 days ago | parent [-] | |||||||
Excellent! Thank you! My problem is that I should have something like (http_status, reason) where http_status is a String or u16, reason is a enum with SomeError(String) structure. So essentially having a flat meaningful structure instead of this what we currently have. I do not have any mental model about the error structure of the AWS libs or don't even know where to start to create that mental model. As a result I just try to turn everything to a string and return it altogether hoping that the real issue is there somwhere in that structure. I think the AWS library error handling is way to complex for what it does and one way we could improve that if Rust had a great example of a binary (bin) project that has lets say 2 layers of functions and showing how to organize your error effectively. Now do this for a lib project. Without this you end up with this hot mess. At least this is how I see it. If you have a suggestion how should I return errors from a util.rs that has s3_list_objects() to my http handler than I would love to hear what you have to say. Thanks for your suggestions anyway! I am going to re-implement my error handling and see if it gives us more clarity with impl. | ||||||||
|