It's better to declare the errors globally via errors.New() so that they are typed and can be checked against without doing string comparisons