Skip to content

Commit

Permalink
Recoverable struct field must be exported
Browse files Browse the repository at this point in the history
  • Loading branch information
schmichael committed Mar 27, 2017
1 parent 6a4e1d1 commit 0e80e7c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/driver/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func TestDockerDriver_Start_BadPull_Recoverable(t *testing.T) {

if rerr, ok := err.(*structs.RecoverableError); !ok {
t.Fatalf("want recoverable error: %+v", err)
} else if !rerr.Recoverable() {
} else if !rerr.IsRecoverable() {
t.Fatalf("error not recoverable: %+v", err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion nomad/node_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2030,7 +2030,7 @@ func TestClientEndpoint_DeriveVaultToken_VaultError(t *testing.T) {
if err != nil {
t.Fatalf("bad: %v", err)
}
if resp.Error == nil || !resp.Error.Recoverable() {
if resp.Error == nil || !resp.Error.IsRecoverable() {
t.Fatalf("bad: %+v", resp.Error)
}
}
6 changes: 3 additions & 3 deletions nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4204,22 +4204,22 @@ func (r *RecoverableError) Error() string {
return r.Err
}

func (r *RecoverableError) Recoverable() bool {
func (r *RecoverableError) IsRecoverable() bool {
return r.recoverable
}

// Recoverable is an interface for errors to implement to indicate whether or
// not they are fatal or recoverable.
type Recoverable interface {
error
Recoverable() bool
IsRecoverable() bool
}

// IsRecoverable returns true if error is a RecoverableError with
// Recoverable=true. Otherwise false is returned.
func IsRecoverable(e error) bool {
if re, ok := e.(Recoverable); ok {
return re.Recoverable()
return re.IsRecoverable()
}
return false
}
2 changes: 1 addition & 1 deletion nomad/vault_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ func TestVaultClient_CreateToken_Prestart(t *testing.T) {

if rerr, ok := err.(*structs.RecoverableError); !ok {
t.Fatalf("Err should have been type recoverable error")
} else if ok && !rerr.Recoverable() {
} else if ok && !rerr.IsRecoverable() {
t.Fatalf("Err should have been recoverable")
}
}
Expand Down

0 comments on commit 0e80e7c

Please sign in to comment.