3 ms·
I don't find it unreasonable to log and return. You know what happened where exactly, but the returned error might be part of a larger process that needs clean
by flippinburgers 7y ago
I don't find it unreasonable to log and return. You know what happened where exactly, but the returned error might be part of a larger process that needs cleanup of other kinds. I default to immediately logging and returning with all the code I write.
- omegabravo 7y agoit is very noisy and hard to see what is happening if you log and return an error at every layer of the stack. Like everything there are exceptions to the rule and at times it makes sense to do both, but it shouldn't be the norm.
- JulianMorrison 7y agoI feel like the rule should be 1. If you can handle it, you probably should also log it since you know what it means and what's being done about it. 2. Otherwise, if you can add pertinent information, like for example the fact that the file you couldn't find was supposed to be the SQLite database, but can't handle it here, wrap and return. Do not log. 3. Otherwise, sticky fingers off, pass it up unaltered. Do not log.