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 (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/buger/jsonparser"
|
"github.com/buger/jsonparser"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"github.com/pterodactyl/wings/config"
|
"github.com/pterodactyl/wings/config"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
|
@ -2,9 +2,9 @@ package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/buger/jsonparser"
|
"github.com/buger/jsonparser"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"go.uber.org/zap"
|
"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 {
|
switch a {
|
||||||
case "start":
|
case "start":
|
||||||
if err := s.Environment.Start(); err != nil {
|
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
|
break
|
||||||
case "stop":
|
case "stop":
|
||||||
if err := s.Environment.Stop(); err != nil {
|
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
|
break
|
||||||
case "restart":
|
case "restart":
|
||||||
break
|
break
|
||||||
case "kill":
|
case "kill":
|
||||||
if err := s.Environment.Terminate(os.Kill); err != nil {
|
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)
|
}(action.Action, s)
|
||||||
|
|
|
@ -2,9 +2,9 @@ package installer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"github.com/asaskevich/govalidator"
|
"github.com/asaskevich/govalidator"
|
||||||
"github.com/buger/jsonparser"
|
"github.com/buger/jsonparser"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"github.com/pterodactyl/wings/config"
|
"github.com/pterodactyl/wings/config"
|
||||||
"github.com/pterodactyl/wings/server"
|
"github.com/pterodactyl/wings/server"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gabriel-vasile/mimetype"
|
"github.com/gabriel-vasile/mimetype"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"github.com/pterodactyl/wings/config"
|
"github.com/pterodactyl/wings/config"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"io"
|
"io"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/patrickmn/go-cache"
|
"github.com/patrickmn/go-cache"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"github.com/pterodactyl/wings/api"
|
"github.com/pterodactyl/wings/api"
|
||||||
"github.com/pterodactyl/wings/config"
|
"github.com/pterodactyl/wings/config"
|
||||||
"github.com/remeh/sizedwaitgroup"
|
"github.com/remeh/sizedwaitgroup"
|
||||||
|
|
|
@ -2,12 +2,12 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gbrlsnchs/jwt/v3"
|
"github.com/gbrlsnchs/jwt/v3"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"github.com/julienschmidt/httprouter"
|
"github.com/julienschmidt/httprouter"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"github.com/pterodactyl/wings/config"
|
"github.com/pterodactyl/wings/config"
|
||||||
"github.com/pterodactyl/wings/server"
|
"github.com/pterodactyl/wings/server"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user