1// Copyright 2015 Keybase, Inc. All rights reserved. Use of
2// this source code is governed by the included BSD license.
3
4package engine
5
6import (
7	"fmt"
8
9	keybase1 "github.com/keybase/client/go/protocol/keybase1"
10)
11
12//=============================================================================
13
14type CheckError struct {
15	m string
16}
17
18func (e CheckError) Error() string {
19	return fmt.Sprintf("Check engine error: %s", e.m)
20}
21
22//=============================================================================
23
24type GPGExportingError struct {
25	err      error
26	inPGPGen bool // did this error happen during pgp generation?
27}
28
29func (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
39type PGPImportStubbedError struct {
40	KeyIDString string
41}
42
43func (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
50type PGPNotActiveForLocalImport struct {
51	kid keybase1.KID
52}
53
54func (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
59type SecretStoreNotFunctionalError struct {
60	err error
61}
62
63func (e SecretStoreNotFunctionalError) Error() string {
64	return fmt.Sprintf("Secret store not functional: %s", e.err)
65}
66