Update middleware logic

This commit is contained in:
Dane Everitt
2020-12-15 20:19:09 -08:00
parent 84c05efaa5
commit acd6dc62d0
10 changed files with 175 additions and 77 deletions

View File

@@ -37,7 +37,7 @@ func getServerArchive(c *gin.Context) {
token := tokens.TransferPayload{}
if err := tokens.ParseToken([]byte(auth[1]), &token); err != nil {
TrackedError(err).AbortWithServerError(c)
TrackedError(err).Abort(c)
return
}
@@ -53,7 +53,7 @@ func getServerArchive(c *gin.Context) {
st, err := s.Archiver.Stat()
if err != nil {
if !errors.Is(err, os.ErrNotExist) {
TrackedServerError(err, s).SetMessage("failed to stat archive").AbortWithServerError(c)
TrackedServerError(err, s).SetMessage("failed to stat archive").Abort(c)
return
}
@@ -63,7 +63,7 @@ func getServerArchive(c *gin.Context) {
checksum, err := s.Archiver.Checksum()
if err != nil {
TrackedServerError(err, s).SetMessage("failed to calculate checksum").AbortWithServerError(c)
TrackedServerError(err, s).SetMessage("failed to calculate checksum").Abort(c)
return
}
@@ -76,7 +76,7 @@ func getServerArchive(c *gin.Context) {
tserr.SetMessage("failed to open archive")
}
tserr.AbortWithServerError(c)
tserr.Abort(c)
return
}
defer file.Close()