5 ms·
Return the first one. You always care more about the original error than an explanation of why you failed in cleaning up after it.
by angelbob 15y ago
Return the first one. You always care more about the original error than an explanation of why you failed in cleaning up after it.
- viraptor 15y agoCounterexample: you failed parsing some number correctly, but the backend where you log broken transactions is corrupted and cannot be written to. You'd rather drop the second information?
- angelbob 15y agoAh, so you're saying that failing to parse the number breaks the transaction. Fair enough, you'd rather (as a human being) have the second one. As a matter of building the system, I would still return the first one. Basically, the second information is important in the sense that you really want an audit trail, but unimportant in that it doesn't tell you why your call failed. Returning it to the caller is useless compared to returning the first error. But yes, it should certainly be logged and potentially acted on. An application can't do anything useful with the information, but an ops guy can. So return the first one.