diff options
Diffstat (limited to 'pkg/monitor/errors.go')
-rw-r--r-- | pkg/monitor/errors.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/pkg/monitor/errors.go b/pkg/monitor/errors.go new file mode 100644 index 0000000..4d676af --- /dev/null +++ b/pkg/monitor/errors.go @@ -0,0 +1,41 @@ +package monitor + +import ( + "fmt" + + ct "github.com/google/certificate-transparency-go" +) + +// ErrorFetch occurs if there's a problem hitting the log's HTTP API. An STH is +// provided if available, since it might carry evidence of some log misbehavior. +type ErrorFetch struct { + URL string + Msg string + Err error + STH *ct.SignedTreeHead +} + +func (e ErrorFetch) Error() string { + return fmt.Sprintf("%s: %s: %v", e.URL, e.Msg, e.Err) +} + +// ErrorMerkleTree occurs if the log's Merkle tree can't be verified. An STH is +// provided if available (i.e., won't be available for internal tree building). +type ErrorMerkleTree struct { + URL string + Msg string + Err error + STH *ct.SignedTreeHead +} + +func (e ErrorMerkleTree) Error() string { + return fmt.Sprintf("%s: %s: %v", e.URL, e.Msg, e.Err) +} + +// TODO: MMD violations +// TODO: Growing read-only logs + +// noout implements the Logger interface to discard unwanted output +type noout struct{} + +func (n *noout) Printf(string, ...interface{}) {} |