github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/teams/hidden/errors.go (about)

     1  package hidden
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/keybase/client/go/protocol/keybase1"
     7  )
     8  
     9  type ManagerError struct {
    10  	note string
    11  }
    12  
    13  func (e ManagerError) Error() string {
    14  	return fmt.Sprintf("hidden team manager error: %s", e.note)
    15  }
    16  
    17  func NewManagerError(format string, args ...interface{}) ManagerError {
    18  	return ManagerError{fmt.Sprintf(format, args...)}
    19  }
    20  
    21  var _ error = ManagerError{}
    22  
    23  type LoaderError struct {
    24  	note string
    25  }
    26  
    27  func (e LoaderError) Error() string {
    28  	return fmt.Sprintf("hidden team loader error: %s", e.note)
    29  }
    30  
    31  func NewLoaderError(format string, args ...interface{}) LoaderError {
    32  	return LoaderError{fmt.Sprintf(format, args...)}
    33  }
    34  
    35  var _ error = LoaderError{}
    36  
    37  type GenerateError struct {
    38  	note string
    39  }
    40  
    41  func (e GenerateError) Error() string {
    42  	return fmt.Sprintf("hidden team generate error: %s", e.note)
    43  }
    44  
    45  func NewGenerateError(format string, args ...interface{}) GenerateError {
    46  	return GenerateError{fmt.Sprintf(format, args...)}
    47  }
    48  
    49  var _ error = GenerateError{}
    50  
    51  type RatchetError struct {
    52  	note string
    53  }
    54  
    55  func (e RatchetError) Error() string {
    56  	return fmt.Sprintf("hidden team ratchet error: %s", e.note)
    57  }
    58  
    59  func newRatchetError(format string, args ...interface{}) RatchetError {
    60  	return RatchetError{fmt.Sprintf(format, args...)}
    61  }
    62  
    63  type HiddenChainNotSupportedError struct {
    64  	teamID keybase1.TeamID
    65  }
    66  
    67  func NewHiddenChainNotSupportedError(teamID keybase1.TeamID) HiddenChainNotSupportedError {
    68  	return HiddenChainNotSupportedError{teamID: teamID}
    69  }
    70  
    71  func (e HiddenChainNotSupportedError) Error() string {
    72  	return fmt.Sprintf("hidden team chain is not enabled for team %s", e.teamID)
    73  }
    74  
    75  type RepeatPTKGenerationError struct {
    76  	q   keybase1.PerTeamKeyGeneration
    77  	msg string
    78  }
    79  
    80  func newRepeatPTKGenerationError(q keybase1.PerTeamKeyGeneration, msg string) RepeatPTKGenerationError {
    81  	return RepeatPTKGenerationError{q, msg}
    82  }
    83  
    84  func (e RepeatPTKGenerationError) Error() string {
    85  	return fmt.Sprintf("Repeated PTK Generation found at %d (%s)", e.q, e.msg)
    86  }
    87  
    88  type ParentPointerError struct {
    89  	q   keybase1.Seqno
    90  	msg string
    91  }
    92  
    93  func newParentPointerError(q keybase1.Seqno, msg string) ParentPointerError {
    94  	return ParentPointerError{q, msg}
    95  }
    96  
    97  func (e ParentPointerError) Error() string {
    98  	return fmt.Sprintf("hidden team parent pointer error (to visible %d): %s", e.q, e.msg)
    99  }
   100  
   101  type TombstonedError struct {
   102  	note string
   103  }
   104  
   105  func (e TombstonedError) Error() string {
   106  	return fmt.Sprintf("hidden team tombstoned error: %s", e.note)
   107  }
   108  
   109  func NewTombstonedError(format string, args ...interface{}) TombstonedError {
   110  	return TombstonedError{fmt.Sprintf(format, args...)}
   111  }
   112  
   113  var _ error = TombstonedError{}