Replace error handling package with emperror; add better reporting for errors escaping server root

This commit is contained in:
Dane Everitt
2020-11-08 13:52:20 -08:00
parent 0989c78d4b
commit be9d1a3986
55 changed files with 396 additions and 367 deletions

View File

@@ -3,9 +3,9 @@ package backup
import (
"bytes"
"context"
"emperror.dev/errors"
"fmt"
"github.com/apex/log"
"github.com/pkg/errors"
"github.com/pterodactyl/wings/api"
"io"
"net/http"
@@ -31,17 +31,17 @@ func (s *S3Backup) Generate(included *IncludedFiles, prefix string) (*ArchiveDet
}
if err := a.Create(s.Path(), context.Background()); err != nil {
return nil, errors.WithStack(err)
return nil, errors.WithStackIf(err)
}
rc, err := os.Open(s.Path())
if err != nil {
return nil, errors.WithStack(err)
return nil, errors.WithStackIf(err)
}
defer rc.Close()
if err := s.generateRemoteRequest(rc); err != nil {
return nil, errors.WithStack(err)
return nil, errors.WithStackIf(err)
}
return s.Details(), err