3 ms·
>They’re not strings. They are strings. They are implementation of interface with a single `to_string` method, after you got `error`, you can't say (you could
by ernst_klim 7y ago
>They’re not strings.
They are strings. They are implementation of interface with a single `to_string` method, after you got `error`, you can't say (you could use switch on type, but you should guess which type could it be), so basically you have an opaque object with a single `to_string` method, which is equivalent to string.
I can't fancy a more error prone way than that which Go choose. How you match the errors, you match strings? You match types? You don't even know what types could there be, since all what the type system says is that function returns error.