4 ms·
I'm starting to find it weird that things like "error while passing string as int" trigger an exception rather than return an error. There are always error cas
by hasenj 9y ago
I'm starting to find it weird that things like "error while passing string as int" trigger an exception rather than return an error.
There are always error cases to check when handling user input. It's a natural part of the program flow, not really an exception.
I would expect an 'exception' to be something like out of memory or disk corruption.
- weberc2 9y agoPresumably you mean "user provided a string which was supposed to be decodable as an int, but was not"? If so, then yes, this should be handled as an input error and not as an exception (programmer error). I don't know if you meant this as a criticism of Go or not, but you should find that Go programs almost always return errors (as opposed to panicking) under such circumstances.