Go errors
An error is a value implementing the Error() string method, returned by a function to report that an operation failed. Go code commonly returns an error as the final result and checks it immediately before using the other returned values.
Minimal example
func findLimit(key string) (int, error) {
if key == "" {
return 0, errors.New("key is required")
}
return 10, nil
}