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

     1  // Copyright 2015 Keybase, Inc. All rights reserved. Use of
     2  // this source code is governed by the included BSD license.
     3  
     4  package engine
     5  
     6  import (
     7  	"fmt"
     8  
     9  	keybase1 "github.com/keybase/client/go/protocol/keybase1"
    10  )
    11  
    12  // =============================================================================
    13  
    14  type CheckError struct {
    15  	m string
    16  }
    17  
    18  func (e CheckError) Error() string {
    19  	return fmt.Sprintf("Check engine error: %s", e.m)
    20  }
    21  
    22  // =============================================================================
    23  
    24  type GPGExportingError struct {
    25  	err      error
    26  	inPGPGen bool // did this error happen during pgp generation?
    27  }
    28  
    29  func (e GPGExportingError) Error() string {
    30  	if e.inPGPGen {
    31  		const msg string = "A PGP key has been generated and added to your account, but exporting to the GPG keychain has failed. You can try to export again using `keybase pgp export -s`."
    32  		return fmt.Sprintf("%s Error during GPG exporting: %s", msg, e.err.Error())
    33  	}
    34  	return e.err.Error()
    35  }
    36  
    37  // =============================================================================
    38  
    39  type PGPImportStubbedError struct {
    40  	KeyIDString string
    41  }
    42  
    43  func (e PGPImportStubbedError) Error() string {
    44  	return fmt.Sprintf("Key %s has a stubbed private key, so we can't import it to the Keybase keychain.",
    45  		e.KeyIDString)
    46  }
    47  
    48  // =============================================================================
    49  
    50  type PGPNotActiveForLocalImport struct {
    51  	kid keybase1.KID
    52  }
    53  
    54  func (e PGPNotActiveForLocalImport) Error() string {
    55  	return fmt.Sprintf("Key %s is not active in user's sigchain. Publish key first to be able to import to local Keybase keychain.",
    56  		e.kid)
    57  }
    58  
    59  type SecretStoreNotFunctionalError struct {
    60  	err error
    61  }
    62  
    63  func (e SecretStoreNotFunctionalError) Error() string {
    64  	return fmt.Sprintf("Secret store not functional: %s", e.err)
    65  }