summaryrefslogtreecommitdiff
path: root/service/static
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-01-13 07:07:16 +0000
committerGitHub <[email protected]>2021-01-13 07:07:16 +0000
commitf18e7f6920590ee6f2e59be508518b70a4611638 (patch)
tree2f80c427e740c2c6f7f2a47be2b869b6d9847e58 /service/static
parent5dc83ef5eee77f4d1ef557e5f8b566e75892680d (diff)
parentbbfcd4fb6eb138c616dab01ea610fbf6ed15985b (diff)
Merge #472
472: feat(http): Distinct app and internal error codes in the handleError function r=48d90782 a=48d90782 This PR introduces distinct error codes for the app and internal RR errors. Errors: ```go roadrunner.ErrNoAssociatedPool roadrunner.ErrAllocateWorker roadrunner.ErrWorkerNotReady roadrunner.ErrEmptyPayload roadrunner.ErrPoolStopped roadrunner.ErrWorkerAllocateTimeout roadrunner.ErrAllWorkersAreDead ``` now associated with the internal error codes. All other errors are application errors. Some types of errors are impossible to distinguish in the RR1, for example `json.Unmarshall` internal error or similar. The `.rr.yaml` now contain two more options for the errors. ```yaml http: internalErrorCode: 502, appErrorCode: 502 ``` Default behavior unchanged (500 error code as before), but now might be overridden. closes #471 Co-authored-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'service/static')
-rw-r--r--service/static/config.go3
-rw-r--r--service/static/config_test.go3
-rw-r--r--service/static/service.go3
-rw-r--r--service/static/service_test.go15
4 files changed, 13 insertions, 11 deletions
diff --git a/service/static/config.go b/service/static/config.go
index 3ca20a83..db50c7dd 100644
--- a/service/static/config.go
+++ b/service/static/config.go
@@ -2,10 +2,11 @@ package static
import (
"fmt"
- "github.com/spiral/roadrunner/service"
"os"
"path"
"strings"
+
+ "github.com/spiral/roadrunner/service"
)
// Config describes file location and controls access to them.
diff --git a/service/static/config_test.go b/service/static/config_test.go
index 8bf0d372..2bc936bb 100644
--- a/service/static/config_test.go
+++ b/service/static/config_test.go
@@ -1,10 +1,11 @@
package static
import (
+ "testing"
+
json "github.com/json-iterator/go"
"github.com/spiral/roadrunner/service"
"github.com/stretchr/testify/assert"
- "testing"
)
type mockCfg struct{ cfg string }
diff --git a/service/static/service.go b/service/static/service.go
index 95b99860..49dbedab 100644
--- a/service/static/service.go
+++ b/service/static/service.go
@@ -1,9 +1,10 @@
package static
import (
- rrhttp "github.com/spiral/roadrunner/service/http"
"net/http"
"path"
+
+ rrhttp "github.com/spiral/roadrunner/service/http"
)
// ID contains default service name.
diff --git a/service/static/service_test.go b/service/static/service_test.go
index 842662c9..bbab86c2 100644
--- a/service/static/service_test.go
+++ b/service/static/service_test.go
@@ -2,18 +2,19 @@ package static
import (
"bytes"
- json "github.com/json-iterator/go"
- "github.com/sirupsen/logrus"
- "github.com/sirupsen/logrus/hooks/test"
- "github.com/spiral/roadrunner/service"
- rrhttp "github.com/spiral/roadrunner/service/http"
- "github.com/stretchr/testify/assert"
"io"
"io/ioutil"
"net/http"
"os"
"testing"
"time"
+
+ json "github.com/json-iterator/go"
+ "github.com/sirupsen/logrus"
+ "github.com/sirupsen/logrus/hooks/test"
+ "github.com/spiral/roadrunner/service"
+ rrhttp "github.com/spiral/roadrunner/service/http"
+ "github.com/stretchr/testify/assert"
)
type testCfg struct {
@@ -75,7 +76,6 @@ func Test_Files(t *testing.T) {
time.Sleep(time.Second)
-
b, _, _ := get("http://localhost:8029/sample.txt")
assert.Equal(t, "sample", b)
c.Stop()
@@ -475,7 +475,6 @@ func TestStatic_Headers(t *testing.T) {
t.Fatal("can't find output header in response")
}
-
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
t.Fatal(err)