photoprism/pkg/clean/error.go
Michael Mayer 91cc358fc5 Clean: Shorten error log sanitization function name #439 #3588
Signed-off-by: Michael Mayer <michael@photoprism.app>
2023-08-15 17:05:55 +02:00

14 lines
297 B
Go

package clean
import "strings"
// Error sanitizes an error message so that it can be safely logged or displayed.
func Error(err error) string {
if err == nil {
return "no error"
} else if s := strings.TrimSpace(err.Error()); s == "" {
return "unknown error"
} else {
return Log(s)
}
}