@gnus_migrate@nebiros In Go we consider errors as values and not fatal or exceptions. For example sql.ErrNoRows , io.EOF, custom… It’s why they are returned and used like any other values.
Errors are values in rust too. There are a couple of differences, like the ? syntax, rust returning a value or an error instead of a value and an error (or nil) for example, but everything you wrote applies to rust as well.
The difference is that you can’t have a generic mechanism in Go for error handling. It’s basically up to the programmer, and every if error != nil line is a potential source of bugs.
@gnus_migrate @nebiros In Go we consider errors as values and not fatal or exceptions. For example sql.ErrNoRows , io.EOF, custom… It’s why they are returned and used like any other values.
Errors are values in rust too. There are a couple of differences, like the
?
syntax, rust returning a value or an error instead of a value and an error (or nil) for example, but everything you wrote applies to rust as well.The difference is that you can’t have a generic mechanism in Go for error handling. It’s basically up to the programmer, and every if error != nil line is a potential source of bugs.