aboutsummaryrefslogtreecommitdiff
path: root/pkg/monitor/errors.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@rgdd.se>2023-12-09 17:08:45 +0100
committerRasmus Dahlberg <rasmus@rgdd.se>2023-12-10 20:38:21 +0100
commit895d5fea41177e444c18f4fdc820fffa5f67d5bf (patch)
tree42fd1e9507384abcd9c6e82f18ccca813f8b6296 /pkg/monitor/errors.go
parentf124940f75e1f49100fe5381019d2f65d6915304 (diff)
Add drafty skeleton
Diffstat (limited to 'pkg/monitor/errors.go')
-rw-r--r--pkg/monitor/errors.go41
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{}) {}