5 ms·
You can ignore an error in Go simply by ignoring its return value. Sometimes it's difficult to tell a foot-gun and land-mine apart.
by crystaldev 7y ago
You can ignore an error in Go simply by ignoring its return value. Sometimes it's difficult to tell a foot-gun and land-mine apart.
- omegabravo 7y agoyou can swallow an exception in java by simply having an empty exception case. Exceptions are certainly more robust, but purposely ignoring errors can be done with exceptions too.
- crystaldev 7y agoIgnoring errors silently, regardless of intention, can't be done with exceptions.
- omegabravo 7y agotry { // do stuff } except( Exception e) { // ignore } and yes, I've seen it often. I will agree that it's not possible to accidentally ignore an exception, since it will likely crash your application.
- crystaldev 7y agoThat's not silent, it's screaming in the code.
- omegabravo 7y agothat's only if you find it in the code
- crystaldev 7y agoI thought we were talking about code though.