Some checks are pending
Docs Deploy / build_and_deploy (push) Waiting to run
Generate Docs / cli (push) Waiting to run
Generate Config Doc / cli (push) Waiting to run
Go formatting / go-formatting (push) Waiting to run
Check links / markdown-link-check (push) Waiting to run
Integration / pre-test (push) Waiting to run
Integration / test on (push) Blocked by required conditions
Integration / status (push) Blocked by required conditions
Lint / Lint Go code (push) Waiting to run
Test / test (ubuntu-latest) (push) Waiting to run
50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
package chain
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/ignite/cli/v29/ignite/config/chain/version"
|
|
"github.com/ignite/cli/v29/ignite/pkg/errors"
|
|
)
|
|
|
|
// ErrConfigNotFound indicates that the config.yml can't be found.
|
|
var ErrConfigNotFound = errors.New("could not locate a config.yml in your chain")
|
|
|
|
// ValidationError is returned when a configuration is invalid.
|
|
type ValidationError struct {
|
|
Message string
|
|
}
|
|
|
|
func (e ValidationError) Error() string {
|
|
return fmt.Sprintf("config is not valid: %s", e.Message)
|
|
}
|
|
|
|
// UnsupportedVersionError is returned when the version of the config is not supported.
|
|
type UnsupportedVersionError struct {
|
|
Version version.Version
|
|
}
|
|
|
|
func (e UnsupportedVersionError) Error() string {
|
|
return fmt.Sprintf("config version %s is not supported", e.Version)
|
|
}
|
|
|
|
// VersionError is returned when config version doesn't match with the version CLI supports.
|
|
type VersionError struct {
|
|
Version version.Version
|
|
}
|
|
|
|
func (e VersionError) Error() string {
|
|
if LatestVersion > e.Version {
|
|
return fmt.Sprintf(
|
|
"blockchain app uses a previous config version %s and CLI expects %s",
|
|
e.Version,
|
|
LatestVersion,
|
|
)
|
|
}
|
|
|
|
return fmt.Sprintf(
|
|
"blockchain app uses a newer config version %s and CLI expects %s",
|
|
e.Version,
|
|
LatestVersion,
|
|
)
|
|
}
|