mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Improve error reporting when moving a transcoded file fails (#4101)
This commit is contained in:
@@ -59,9 +59,9 @@ func SafeMove(src, dst string) error {
|
|||||||
err := os.Rename(src, dst)
|
err := os.Rename(src, dst)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = CopyFile(src, dst)
|
copyErr := CopyFile(src, dst)
|
||||||
if err != nil {
|
if copyErr != nil {
|
||||||
return err
|
return fmt.Errorf("copying file during SaveMove failed with: '%w'; renaming file failed previously with: '%v'", copyErr, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os.Remove(src)
|
err = os.Remove(src)
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ func (g Generator) generateFile(lockCtx *fsutil.LockContext, p Paths, pattern st
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := fsutil.SafeMove(tmpFn, output); err != nil {
|
if err := fsutil.SafeMove(tmpFn, output); err != nil {
|
||||||
return fmt.Errorf("moving %s to %s", tmpFn, output)
|
return fmt.Errorf("moving %s to %s failed: %w", tmpFn, output, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user