2019-11-30 23:19:08 +00:00
|
|
|
package server
|
|
|
|
|
2020-11-28 23:57:10 +00:00
|
|
|
import (
|
2020-12-16 05:56:53 +00:00
|
|
|
"emperror.dev/errors"
|
2020-11-28 23:57:10 +00:00
|
|
|
)
|
2019-11-30 23:19:08 +00:00
|
|
|
|
2020-12-25 21:32:41 +00:00
|
|
|
var (
|
|
|
|
ErrIsRunning = errors.New("server is running")
|
|
|
|
ErrSuspended = errors.New("server is currently in a suspended state")
|
|
|
|
ErrServerIsInstalling = errors.New("server is currently installing")
|
|
|
|
ErrServerIsTransferring = errors.New("server is currently being transferred")
|
|
|
|
)
|
2019-12-01 00:43:18 +00:00
|
|
|
|
|
|
|
type crashTooFrequent struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *crashTooFrequent) Error() string {
|
|
|
|
return "server has crashed too soon after the last detected crash"
|
|
|
|
}
|
|
|
|
|
|
|
|
func IsTooFrequentCrashError(err error) bool {
|
|
|
|
_, ok := err.(*crashTooFrequent)
|
|
|
|
|
|
|
|
return ok
|
|
|
|
}
|
2019-12-17 04:47:35 +00:00
|
|
|
|
|
|
|
type serverDoesNotExist struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *serverDoesNotExist) Error() string {
|
|
|
|
return "server does not exist on remote system"
|
|
|
|
}
|
|
|
|
|
|
|
|
func IsServerDoesNotExistError(err error) bool {
|
|
|
|
_, ok := err.(*serverDoesNotExist)
|
|
|
|
|
|
|
|
return ok
|
2020-09-05 19:08:40 +00:00
|
|
|
}
|