3 ms·
You check each one for an error and return a 500 if there's an error. It takes a few more seconds to write but is incredibly easy to read and maintain. I'd ar
by cle 6y ago
You check each one for an error and return a 500 if there's an error. It takes a few more seconds to write but is incredibly easy to read and maintain.
I'd argue that this article is evidence that Rust's syntactic sugar doesn't really help, it just seems like "official" encouragement to do the wrong thing (pass the buck).
- throw_m239339 6y ago> It takes a few more seconds to write but is incredibly easy to read and maintain. I disagree. try{ dothis(); /* ... 14 lines of dothis(); like */ catch(error){ log(error); return responseCode(500); } sounds easier to both write and maintain to me. Only a handfull of times you'd ever want to deal with each exception separately. And when you do, it's not much more verbose than if err!=nil{ ... }.