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

@@ -41,7 +41,7 @@ func getServerLogs(c *gin.Context) {
out, err := s.ReadLogfile(l)
if err != nil {
TrackedServerError(err, s).AbortWithServerError(c)
TrackedServerError(err, s).Abort(c)
return
}
@@ -110,7 +110,7 @@ func postServerCommands(c *gin.Context) {
s := GetServer(c.Param("server"))
if running, err := s.Environment.IsRunning(); err != nil {
TrackedServerError(err, s).AbortWithServerError(c)
TrackedServerError(err, s).Abort(c)
return
} else if !running {
c.AbortWithStatusJSON(http.StatusBadGateway, gin.H{
@@ -144,7 +144,7 @@ func patchServer(c *gin.Context) {
buf.ReadFrom(c.Request.Body)
if err := s.UpdateDataStructure(buf.Bytes()); err != nil {
TrackedServerError(err, s).AbortWithServerError(c)
TrackedServerError(err, s).Abort(c)
return
}
@@ -214,7 +214,7 @@ func deleteServer(c *gin.Context) {
// forcibly terminate it before removing the container, so we do not need to handle
// that here.
if err := s.Environment.Destroy(); err != nil {
TrackedServerError(err, s).AbortWithServerError(c)
TrackedServerError(err, s).Abort(c)
}
// Once the environment is terminated, remove the server files from the system. This is