summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/keybase/go-keybase-chat-bot/kbchat/errors.go
blob: 2b8e929df4126c28df4de253edda637332dbc3f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package kbchat

import "fmt"

type ErrorCode int

const (
	RevisionErrorCode          ErrorCode = 2760
	DeleteNonExistentErrorCode ErrorCode = 2762
)

// Error is for unmarshaling CLI json responses
type Error struct {
	Code    ErrorCode `json:"code"`
	Message string    `json:"message"`
}

func (e Error) Error() string {
	return fmt.Sprintf("received error response from keybase api: %s", e.Message)
}

type APIError struct {
	err error
}

func (e APIError) Error() string {
	return fmt.Sprintf("failed to call keybase api: %v", e.err)
}

type UnmarshalError struct {
	err error
}

func (e UnmarshalError) Error() string {
	return fmt.Sprintf("failed to parse output from keybase api: %v", e.err)
}