enbas/internal/executor/errors.go

104 lines
2 KiB
Go

package executor
import "fmt"
type Error struct {
message string
}
func (e Error) Error() string {
return e.message
}
type FlagNotSetError struct {
flagText string
}
func (e FlagNotSetError) Error() string {
return "please use the required --" + e.flagText + " flag"
}
type UnsupportedTypeError struct {
resourceType string
}
func (e UnsupportedTypeError) Error() string {
return "'" + e.resourceType + "' is not supported for this operation"
}
type NoAccountSpecifiedError struct{}
func (e NoAccountSpecifiedError) Error() string {
return "no account specified in this request"
}
type UnsupportedAddOperationError struct {
resourceType string
addToResourceType string
}
func (e UnsupportedAddOperationError) Error() string {
return "adding '" +
e.resourceType +
"' to '" +
e.addToResourceType +
"' is not supported"
}
type UnsupportedRemoveOperationError struct {
resourceType string
removeFromResourceType string
}
func (e UnsupportedRemoveOperationError) Error() string {
return "removing '" +
e.resourceType +
"' from '" +
e.removeFromResourceType +
"' is not supported"
}
type UnsupportedShowOperationError struct {
resourceType string
showFromResourceType string
}
func (e UnsupportedShowOperationError) Error() string {
return "showing '" +
e.resourceType +
"' from '" +
e.showFromResourceType +
"' is not supported"
}
type UnknownCommandError struct {
command string
}
func (e UnknownCommandError) Error() string {
return "unknown command '" + e.command + "'"
}
type NotFollowingError struct {
account string
}
func (e NotFollowingError) Error() string {
return "you are not following " + e.account
}
type MismatchedNumMediaArgs struct {
argType string
numArgs int
numMediaFiles int
}
func (e MismatchedNumMediaArgs) Error() string {
return fmt.Sprintf(
"unexpected number of %s: received %d media files but got %d %s",
e.argType,
e.numMediaFiles,
e.numArgs,
e.argType,
)
}