1package client
2
3import (
4	"fmt"
5
6	"github.com/theupdateframework/notary/tuf/data"
7)
8
9// ErrRepoNotInitialized is returned when trying to publish an uninitialized
10// notary repository
11type ErrRepoNotInitialized struct{}
12
13func (err ErrRepoNotInitialized) Error() string {
14	return "repository has not been initialized"
15}
16
17// ErrInvalidRemoteRole is returned when the server is requested to manage
18// a key type that is not permitted
19type ErrInvalidRemoteRole struct {
20	Role data.RoleName
21}
22
23func (err ErrInvalidRemoteRole) Error() string {
24	return fmt.Sprintf(
25		"notary does not permit the server managing the %s key", err.Role.String())
26}
27
28// ErrInvalidLocalRole is returned when the client wants to manage
29// a key type that is not permitted
30type ErrInvalidLocalRole struct {
31	Role data.RoleName
32}
33
34func (err ErrInvalidLocalRole) Error() string {
35	return fmt.Sprintf(
36		"notary does not permit the client managing the %s key", err.Role)
37}
38
39// ErrRepositoryNotExist is returned when an action is taken on a remote
40// repository that doesn't exist
41type ErrRepositoryNotExist struct {
42	remote string
43	gun    data.GUN
44}
45
46func (err ErrRepositoryNotExist) Error() string {
47	return fmt.Sprintf("%s does not have trust data for %s", err.remote, err.gun.String())
48}
49