91cc358fc5
Signed-off-by: Michael Mayer <michael@photoprism.app>
14 lines
297 B
Go
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)
|
|
}
|
|
}
|