4 ms·
Nevertheless, this is how it is mostly done in Java. I haven't used eclipse in eons, but last time I did it even generated this code. If you care with go, use
by fooster 6y ago
Nevertheless, this is how it is mostly done in Java. I haven't used eclipse in eons, but last time I did it even generated this code.
If you care with go, use errcheck.
- apta 6y agoDoes errcheck work well with gorm (https://gorm.io/ https://gorm.io/) and it's way of returning errors? This is not an obscure library, it's quite widely used.
- ori_b 6y agoDoes any language save you from explicitly screwing up error handling? Gorm is doing the Go equivalent of: class Query { class QueryResult { Exception error; Value result; } public QueryResult query() { try { return doThing(); } catch(Exception e){ return new QueryResult(error, null); } } } Gorm is going out of its way to make error handling suck.
- apta 6y ago> Does any language save you from explicitly screwing up error handling? It's about the default error handling method being sane. In exception based languages, an unhandled error bubbles up until it reaches a handler, or it crashes the program with a stacktrace. Compare to what golang does, it's somewhat easy to accidentally ignore or overwrite errors. This leads to silent corruption of state, much worse than crashing the program outright.
- ori_b 6y ago> It's about the default error handling method being sane. Gorm isn't using the default error handling.
- apta 6y agoThat's one point in this discussion. The language allows error handling that way. Compared to a language with proper sum types or exceptions, where one would have to actively work against the language to end up with that mess.
- ori_b 6y ago> That's one point in this discussion. The language allows error handling that way. Compared to a language with proper sum types or exceptions, where one would have to actively work against the language to end up with that mess. I've seen a bunch of code that does the equivalent of the Java I posted above. Mostly when sending errors across the network.