46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
|
|
package errors
|
||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
|
|
||
|
|
"code.gitea.io/gitea/models/repo"
|
||
|
|
"code.gitea.io/gitea/models/user"
|
||
|
|
)
|
||
|
|
|
||
|
|
type ErrIllegalParams struct {
|
||
|
|
FieldNameList []string
|
||
|
|
}
|
||
|
|
|
||
|
|
func (err ErrIllegalParams) Error() string {
|
||
|
|
return fmt.Sprintf("Illegal Params: %v", err.FieldNameList)
|
||
|
|
}
|
||
|
|
|
||
|
|
type ErrOperateDevcontainer struct {
|
||
|
|
Action string
|
||
|
|
Message string
|
||
|
|
}
|
||
|
|
|
||
|
|
func (err ErrOperateDevcontainer) Error() string {
|
||
|
|
return fmt.Sprintf("Failed to %s in DevContainer Service: %s", err.Action, err.Message)
|
||
|
|
}
|
||
|
|
|
||
|
|
type ErrDevcontainerAlreadyCreated struct {
|
||
|
|
Actor *user.User
|
||
|
|
Repository *repo.Repository
|
||
|
|
}
|
||
|
|
|
||
|
|
func (err ErrDevcontainerAlreadyCreated) Error() string {
|
||
|
|
return fmt.Sprintf("Failed to create DevContainer in repo '%s'(repoId = %d) by user '%s'(userId = %d), since it already exists.",
|
||
|
|
err.Repository.Name, err.Repository.ID, err.Actor.Name, err.Actor.ID)
|
||
|
|
}
|
||
|
|
|
||
|
|
type ErrDevcontainerNotFound struct {
|
||
|
|
Actor *user.User
|
||
|
|
Repository *repo.Repository
|
||
|
|
}
|
||
|
|
|
||
|
|
func (err ErrDevcontainerNotFound) Error() string {
|
||
|
|
return fmt.Sprintf("DevContainer NOT found in repo '%s'(repoId = %d) of user '%s'(userId = %d)",
|
||
|
|
err.Repository.Name, err.Repository.ID, err.Actor.Name, err.Actor.ID)
|
||
|
|
}
|