forked from rosa/hakurei
internal/report: strict-exempt severity
For reportable but inconsequential errors like modprobe by MODALIAS failures. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -15,8 +15,10 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// Trivial denotes an error that may happen frequently under normal operation.
|
||||
Trivial = iota
|
||||
// Inconsistent denotes an error diagnosed due to inconsistent state.
|
||||
Inconsistent = iota
|
||||
Inconsistent
|
||||
// Degraded denotes an error condition causing a degraded state.
|
||||
Degraded
|
||||
// Fatal denotes an unrecoverable error. This is generally followed by
|
||||
@@ -88,6 +90,8 @@ func (e Error) MarshalJSON() (data []byte, err error) {
|
||||
}{Message: e.Message}
|
||||
|
||||
switch e.Severity {
|
||||
case Trivial:
|
||||
v.Severity = "trivial"
|
||||
case Inconsistent:
|
||||
v.Severity = "inconsistent"
|
||||
case Degraded:
|
||||
@@ -162,11 +166,11 @@ func (r *Reporter) dispatch(severity int, message string, e error) (err error) {
|
||||
err = _err
|
||||
}
|
||||
r.mu.Unlock()
|
||||
} else if flag&DBypassEarly == 0 {
|
||||
} else if flag&DBypassEarly == 0 && severity != Trivial {
|
||||
panic(p)
|
||||
}
|
||||
|
||||
if flag&DStrict != 0 {
|
||||
if flag&DStrict != 0 && severity != Trivial {
|
||||
panic(p)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user