Suppress benign broken pipe and context closed warnings (#2927)

This commit is contained in:
DingDongSoLong4
2022-09-19 07:01:40 +02:00
committed by GitHub
parent 5e97ecd260
commit 8efbcc1c4d
11 changed files with 172 additions and 105 deletions

View File

@@ -84,14 +84,10 @@ func FileExists(path string) (bool, error) {
func WriteFile(path string, file []byte) error {
pathErr := EnsureDirAll(filepath.Dir(path))
if pathErr != nil {
return fmt.Errorf("cannot ensure path %s", pathErr)
return fmt.Errorf("cannot ensure path exists: %w", pathErr)
}
err := os.WriteFile(path, file, 0755)
if err != nil {
return fmt.Errorf("write error for thumbnail %s: %s ", path, err)
}
return nil
return os.WriteFile(path, file, 0755)
}
// GetNameFromPath returns the name of a file from its path