mirror of
https://github.com/stashapp/stash.git
synced 2025-12-16 20:07:05 +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)
|
||||
|
||||
if err != nil {
|
||||
err = CopyFile(src, dst)
|
||||
if err != nil {
|
||||
return err
|
||||
copyErr := CopyFile(src, dst)
|
||||
if copyErr != nil {
|
||||
return fmt.Errorf("copying file during SaveMove failed with: '%w'; renaming file failed previously with: '%v'", copyErr, err)
|
||||
}
|
||||
|
||||
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 {
|
||||
return fmt.Errorf("moving %s to %s", tmpFn, output)
|
||||
return fmt.Errorf("moving %s to %s failed: %w", tmpFn, output, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user