News for hackers. Stuff that matters.
Re:Errors are values by chrisfarms on Monday January 12, 2015 @09:14PM (#8877729)
One thing I love about the repetitive err pattern is that I find my self wrapping/appending errors with useful context more frequently (rather than say catching an exception five frames further down and just appending "mylib: oops").

I realise the later was just laziness on my part, but the constant err checking really does force good habits on me, which of course yields higher quality code that's easier to reason about when something goes wrong.

Re:Errors are values by rdtsc on Monday January 12, 2015 @09:45PM (#8877818)
> (rather than say catching an exception five frames further down and just appending "mylib: oops").

That is why I like exceptions, so I don't have to explain possible errors like this if I don't have to, but can get a top level exception and see a stacktrace with it. Then choose to add aditional info.

I really like that pattern and use it quite a bit. For example, it is easy to turn code that connect into a piece of code that re-connects with a back-off without having to modify lower layers of the connect call itself (say because it is already in a library).