Correct some error handling, use package that provides useful stack traces
This commit is contained in:
parent
56be65888c
commit
cae0090763
|
@ -2,9 +2,9 @@ package api
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/buger/jsonparser"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/pterodactyl/wings/config"
|
||||
"go.uber.org/zap"
|
||||
"io/ioutil"
|
||||
|
|
|
@ -2,9 +2,9 @@ package api
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/buger/jsonparser"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
|
21
http.go
21
http.go
|
@ -158,19 +158,34 @@ func (rt *Router) routeServerPower(w http.ResponseWriter, r *http.Request, ps ht
|
|||
switch a {
|
||||
case "start":
|
||||
if err := s.Environment.Start(); err != nil {
|
||||
zap.S().Error(err, zap.String("server", s.Uuid), zap.String("action", "start"))
|
||||
zap.S().Errorw(
|
||||
"encountered unexpected error starting server process",
|
||||
zap.Error(err),
|
||||
zap.String("server", s.Uuid),
|
||||
zap.String("action", "start"),
|
||||
)
|
||||
}
|
||||
break
|
||||
case "stop":
|
||||
if err := s.Environment.Stop(); err != nil {
|
||||
zap.S().Error(err, zap.String("server", s.Uuid), zap.String("action", "stop"))
|
||||
zap.S().Errorw(
|
||||
"encountered unexpected error stopping server process",
|
||||
zap.Error(err),
|
||||
zap.String("server", s.Uuid),
|
||||
zap.String("action", "stop"),
|
||||
)
|
||||
}
|
||||
break
|
||||
case "restart":
|
||||
break
|
||||
case "kill":
|
||||
if err := s.Environment.Terminate(os.Kill); err != nil {
|
||||
zap.S().Error(err, zap.String("server", s.Uuid), zap.String("action", "kill"))
|
||||
zap.S().Errorw(
|
||||
"encountered unexpected error killing server process",
|
||||
zap.Error(err),
|
||||
zap.String("server", s.Uuid),
|
||||
zap.String("action", "kill"),
|
||||
)
|
||||
}
|
||||
}
|
||||
}(action.Action, s)
|
||||
|
|
|
@ -2,9 +2,9 @@ package installer
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/asaskevich/govalidator"
|
||||
"github.com/buger/jsonparser"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/pterodactyl/wings/config"
|
||||
"github.com/pterodactyl/wings/server"
|
||||
"go.uber.org/zap"
|
||||
|
|
|
@ -4,9 +4,9 @@ import (
|
|||
"bufio"
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/gabriel-vasile/mimetype"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/pterodactyl/wings/config"
|
||||
"go.uber.org/zap"
|
||||
"io"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/patrickmn/go-cache"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/pterodactyl/wings/api"
|
||||
"github.com/pterodactyl/wings/config"
|
||||
"github.com/remeh/sizedwaitgroup"
|
||||
|
|
|
@ -2,12 +2,12 @@ package main
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/gbrlsnchs/jwt/v3"
|
||||
"github.com/google/uuid"
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/julienschmidt/httprouter"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/pterodactyl/wings/config"
|
||||
"github.com/pterodactyl/wings/server"
|
||||
"go.uber.org/zap"
|
||||
|
|
Loading…
Reference in New Issue
Block a user