Files
gotes/internal/repository/errors.go

35 lines
656 B
Go

package repository
import (
"fmt"
"git.hrafn.xyz/aether/notes/internal/models"
)
type EmptyContent struct {}
type EmptyTitle struct {}
type NoOP struct {}
type EmptyUpdate struct{}
type TitleOverflow struct {
length int
}
func (e *EmptyContent) Error() string {
return "content cannot be empty"
}
func (e *EmptyTitle) Error() string {
return "title cannot be empty"
}
func (e *NoOP) Error() string {
return "no operation required"
}
func (e *EmptyUpdate) Error() string {
return "update cannot be empty"
}
func (e *TitleOverflow) Error() string {
return fmt.Sprintf("title max length %d, %d provided", models.NoteTitleMaxLength, e.length)
}