2024-05-23 18:06:49 +01:00
|
|
|
package executor
|
|
|
|
|
2024-08-17 11:23:21 +01:00
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
type Error struct {
|
|
|
|
message string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e Error) Error() string {
|
|
|
|
return e.message
|
|
|
|
}
|
|
|
|
|
2024-05-23 18:06:49 +01:00
|
|
|
type FlagNotSetError struct {
|
|
|
|
flagText string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e FlagNotSetError) Error() string {
|
2024-06-02 11:35:43 +01:00
|
|
|
return "please use the required --" + e.flagText + " flag"
|
2024-05-23 18:06:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type UnsupportedTypeError struct {
|
|
|
|
resourceType string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e UnsupportedTypeError) Error() string {
|
2024-06-02 11:35:43 +01:00
|
|
|
return "'" + e.resourceType + "' is not supported for this operation"
|
2024-05-23 18:06:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type NoAccountSpecifiedError struct{}
|
|
|
|
|
|
|
|
func (e NoAccountSpecifiedError) Error() string {
|
|
|
|
return "no account specified in this request"
|
|
|
|
}
|
|
|
|
|
|
|
|
type UnsupportedAddOperationError struct {
|
2024-08-17 11:23:21 +01:00
|
|
|
resourceType string
|
|
|
|
addToResourceType string
|
2024-05-23 18:06:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e UnsupportedAddOperationError) Error() string {
|
2024-06-15 18:40:13 +01:00
|
|
|
return "adding '" +
|
2024-08-17 11:23:21 +01:00
|
|
|
e.resourceType +
|
2024-06-15 18:40:13 +01:00
|
|
|
"' to '" +
|
2024-08-17 11:23:21 +01:00
|
|
|
e.addToResourceType +
|
2024-06-15 18:40:13 +01:00
|
|
|
"' is not supported"
|
2024-05-23 18:06:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type UnsupportedRemoveOperationError struct {
|
2024-08-17 11:23:21 +01:00
|
|
|
resourceType string
|
|
|
|
removeFromResourceType string
|
2024-05-23 18:06:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e UnsupportedRemoveOperationError) Error() string {
|
2024-06-15 18:40:13 +01:00
|
|
|
return "removing '" +
|
2024-08-17 11:23:21 +01:00
|
|
|
e.resourceType +
|
2024-06-15 18:40:13 +01:00
|
|
|
"' from '" +
|
2024-08-17 11:23:21 +01:00
|
|
|
e.removeFromResourceType +
|
2024-06-15 18:40:13 +01:00
|
|
|
"' is not supported"
|
2024-05-23 18:06:49 +01:00
|
|
|
}
|
|
|
|
|
2024-07-03 14:20:25 +01:00
|
|
|
type UnsupportedShowOperationError struct {
|
2024-08-17 11:23:21 +01:00
|
|
|
resourceType string
|
|
|
|
showFromResourceType string
|
2024-07-03 14:20:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e UnsupportedShowOperationError) Error() string {
|
|
|
|
return "showing '" +
|
2024-08-17 11:23:21 +01:00
|
|
|
e.resourceType +
|
2024-07-03 14:20:25 +01:00
|
|
|
"' from '" +
|
2024-08-17 11:23:21 +01:00
|
|
|
e.showFromResourceType +
|
2024-07-03 14:20:25 +01:00
|
|
|
"' is not supported"
|
|
|
|
}
|
|
|
|
|
2024-06-10 18:59:01 +01:00
|
|
|
type UnknownCommandError struct {
|
2024-08-17 11:23:21 +01:00
|
|
|
command string
|
2024-06-10 18:59:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e UnknownCommandError) Error() string {
|
2024-08-17 11:23:21 +01:00
|
|
|
return "unknown command '" + e.command + "'"
|
2024-06-10 18:59:01 +01:00
|
|
|
}
|
2024-06-15 18:40:13 +01:00
|
|
|
|
2024-08-17 11:23:21 +01:00
|
|
|
type NotFollowingError struct {
|
|
|
|
account string
|
2024-06-15 18:40:13 +01:00
|
|
|
}
|
2024-06-16 20:29:16 +01:00
|
|
|
|
2024-08-17 11:23:21 +01:00
|
|
|
func (e NotFollowingError) Error() string {
|
|
|
|
return "you are not following " + e.account
|
2024-08-14 11:18:38 +01:00
|
|
|
}
|
|
|
|
|
2024-08-17 11:23:21 +01:00
|
|
|
type MismatchedNumMediaValuesError struct {
|
|
|
|
valueType string
|
|
|
|
numValues int
|
|
|
|
numMediaFiles int
|
2024-08-14 11:18:38 +01:00
|
|
|
}
|
|
|
|
|
2024-08-17 11:23:21 +01:00
|
|
|
func (e MismatchedNumMediaValuesError) Error() string {
|
|
|
|
return fmt.Sprintf(
|
|
|
|
"unexpected number of %s: received %d media files but got %d %s",
|
|
|
|
e.valueType,
|
|
|
|
e.numMediaFiles,
|
|
|
|
e.numValues,
|
|
|
|
e.valueType,
|
|
|
|
)
|
2024-08-14 11:18:38 +01:00
|
|
|
}
|
|
|
|
|
2024-08-17 11:23:21 +01:00
|
|
|
type UnexpectedNumValuesError struct {
|
|
|
|
name string
|
|
|
|
actual int
|
|
|
|
expected int
|
2024-06-16 20:29:16 +01:00
|
|
|
}
|
|
|
|
|
2024-08-17 11:23:21 +01:00
|
|
|
func (e UnexpectedNumValuesError) Error() string {
|
|
|
|
return fmt.Sprintf(
|
|
|
|
"received an unexpected number of %s: received %d, expected %d",
|
|
|
|
e.name,
|
|
|
|
e.actual,
|
|
|
|
e.expected,
|
|
|
|
)
|
2024-06-16 20:29:16 +01:00
|
|
|
}
|
2024-08-18 08:59:44 +01:00
|
|
|
|
|
|
|
type MissingIDError struct {
|
|
|
|
resource string
|
|
|
|
action string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e MissingIDError) Error() string {
|
|
|
|
return "please provide the ID of the " + e.resource + " you want to " + e.action
|
|
|
|
}
|