▲ | Attummm a day ago | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
For me, the issue with error handling is that while errors are explicitly stated, they are often poorly handled. Rarely have I seen the handling of multiple reasons for why an error might occur, along with tailored approaches to handle each case. This is something very common in older languages like Python or Java | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | cnity a day ago | parent | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
As a regular Go user, I agree with this take. Though the tools exist, error wrapping and checking (with errors.Is and so on) is actually pretty rare in my experience. Positive example of good and appropriate usage here: https://github.com/coder/websocket/blob/master/internal/exam... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | Cthulhu_ a day ago | parent | prev [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This is down to developer style and agreements though; Go has typed errors and a set of utilities to match them [0]. Not using those is a choice, just like how in Java you can just `catch (Exception e)` after calling a dozen methods that might each throw a different exception. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|