diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-13 07:07:16 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-13 07:07:16 +0000 |
commit | f18e7f6920590ee6f2e59be508518b70a4611638 (patch) | |
tree | 2f80c427e740c2c6f7f2a47be2b869b6d9847e58 /service/limit | |
parent | 5dc83ef5eee77f4d1ef557e5f8b566e75892680d (diff) | |
parent | bbfcd4fb6eb138c616dab01ea610fbf6ed15985b (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/limit')
-rw-r--r-- | service/limit/config.go | 3 | ||||
-rw-r--r-- | service/limit/config_test.go | 5 | ||||
-rw-r--r-- | service/limit/controller.go | 3 | ||||
-rw-r--r-- | service/limit/state_filter.go | 3 |
4 files changed, 9 insertions, 5 deletions
diff --git a/service/limit/config.go b/service/limit/config.go index 203db11b..7a56280d 100644 --- a/service/limit/config.go +++ b/service/limit/config.go @@ -1,9 +1,10 @@ package limit import ( + "time" + "github.com/spiral/roadrunner" "github.com/spiral/roadrunner/service" - "time" ) // Config of Limit service. diff --git a/service/limit/config_test.go b/service/limit/config_test.go index c79836b8..1f121bc5 100644 --- a/service/limit/config_test.go +++ b/service/limit/config_test.go @@ -1,11 +1,12 @@ package limit import ( + "testing" + "time" + json "github.com/json-iterator/go" "github.com/spiral/roadrunner/service" "github.com/stretchr/testify/assert" - "testing" - "time" ) type mockCfg struct{ cfg string } diff --git a/service/limit/controller.go b/service/limit/controller.go index 24a158f7..b4a1c25f 100644 --- a/service/limit/controller.go +++ b/service/limit/controller.go @@ -2,9 +2,10 @@ package limit import ( "fmt" + "time" + "github.com/spiral/roadrunner" "github.com/spiral/roadrunner/util" - "time" ) const ( diff --git a/service/limit/state_filter.go b/service/limit/state_filter.go index cd2eca94..4e05769a 100644 --- a/service/limit/state_filter.go +++ b/service/limit/state_filter.go @@ -1,8 +1,9 @@ package limit import ( - "github.com/spiral/roadrunner" "time" + + "github.com/spiral/roadrunner" ) type stateFilter struct { |