Nil is not an error, much less a serious one.

This commit is contained in:
Kistaro Windrider 2023-04-02 19:03:39 -07:00
parent 159f6b6b5f
commit 00ea284cbc
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8
1 changed files with 3 additions and 0 deletions

View File

@ -55,6 +55,9 @@ func Warningf(f string, args ...any) *Warning {
// IsSeriousError returns whether e is a non-warning error. If e is nil, this
// returns false.
func IsSeriousError(e error) bool {
if e == nil {
return false
}
return !errors.Is(e, AnyWarning)
}