diff --git a/models/error.go b/models/error.go index 768d68ae..83378c37 100644 --- a/models/error.go +++ b/models/error.go @@ -122,56 +122,4 @@ func IsErrIDCannotBeZero(err error) bool { func (err ErrIDCannotBeZero) Error() string { return fmt.Sprintf("ID cannot be 0") -} - -// ErrAuthorCannotBeEmpty represents a "AuthorCannotBeEmpty" kind of error. -type ErrAuthorCannotBeEmpty struct{} - -// IsErrAuthorCannotBeEmpty checks if an error is a ErrAuthorCannotBeEmpty. -func IsErrAuthorCannotBeEmpty(err error) bool { - _, ok := err.(ErrAuthorCannotBeEmpty) - return ok -} - -func (err ErrAuthorCannotBeEmpty) Error() string { - return fmt.Sprintf("author cannot be empty") -} - -// ErrItemTitleCannotBeEmpty represents a "ErrItemTitleCannotBeEmpty" kind of error. -type ErrItemTitleCannotBeEmpty struct{} - -// IsErrItemTitleCannotBeEmpty checks if an error is a ErrItemTitleCannotBeEmpty. -func IsErrItemTitleCannotBeEmpty(err error) bool { - _, ok := err.(ErrItemTitleCannotBeEmpty) - return ok -} - -func (err ErrItemTitleCannotBeEmpty) Error() string { - return fmt.Sprintf("title cannot be empty") -} - -// ErrBookTitleCannotBeEmpty represents a "ErrBookTitleCannotBeEmpty" kind of error. -type ErrBookTitleCannotBeEmpty struct{} - -// IsErrBookTitleCannotBeEmpty checks if an error is a ErrBookTitleCannotBeEmpty. -func IsErrBookTitleCannotBeEmpty(err error) bool { - _, ok := err.(ErrBookTitleCannotBeEmpty) - return ok -} - -func (err ErrBookTitleCannotBeEmpty) Error() string { - return fmt.Sprintf("the book should at least have a title") -} - -// ErrNoPublisherName represents a "ErrNoPublisherName" kind of error. -type ErrNoPublisherName struct{} - -// IsErrNoPublisherName checks if an error is a ErrNoPublisherName. -func IsErrNoPublisherName(err error) bool { - _, ok := err.(ErrNoPublisherName) - return ok -} - -func (err ErrNoPublisherName) Error() string { - return fmt.Sprintf("you need at least a name to insert a new publisher") -} +} \ No newline at end of file