pelican/internal/board/errors.go

54 lines
1.4 KiB
Go
Raw Permalink Normal View History

package board
import "fmt"
// CardNotExistError is returned when a card does not exist in the database.
type CardNotExistError struct {
ID int
}
func (e CardNotExistError) Error() string {
return fmt.Sprintf("card ID '%d' does not exist in the database", e.ID)
}
// InvalidIDError is an error for when an attempt to set an ID lower than 1 is made.
type InvalidIDError struct {
ID int
}
func ( e InvalidIDError) Error() string {
return fmt.Sprintf("'%d' is an invalid ID", e.ID)
}
// IDAlreadySetError is an error for when an attempt is made to set an ID that has already been set.
type IDAlreadySetError struct {}
func (e IDAlreadySetError) Error() string {
return "the item's ID is already set"
}
// StatusListEmptyError is an error for unexpected empty list of statuses.
type StatusListEmptyError struct{}
func (e StatusListEmptyError) Error() string {
return "the status list must not be empty"
}
// StatusNotExistError is an error for when a status cannot be found in the database.
type StatusNotExistError struct {
ID int
}
func (e StatusNotExistError) Error() string {
return fmt.Sprintf("status ID '%d' does not exist in the database", e.ID)
}
// StatusNotEmptyError is an error for when an attempt is made to delete non-empty statuses.
type StatusNotEmptyError struct {
ID int
}
func (e StatusNotEmptyError) Error() string {
return fmt.Sprintf("status ID '%d' must contain no cards before deletion", e.ID)
}