Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change http response code based on backend error #16115

Merged
merged 4 commits into from Nov 17, 2022

Conversation

k15r
Copy link
Contributor

@k15r k15r commented Nov 17, 2022

Description

Changes proposed in this pull request:

  • if a stream is full (jetstream) we report now 507
  • if a stream does not exists (jetstream) we report 502
  • ...

Related issue(s)

@k15r k15r added the area/eventing Issues or PRs related to eventing label Nov 17, 2022
@kyma-bot kyma-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 17, 2022
@@ -26,6 +26,7 @@ const (
natsBackend = "nats"
jestreamHandlerName = "jetstream-handler"
noSpaceLeftErrMessage = "no space left on device"
natsMaxBytesExceeded = "nats: maximum bytes exceeded"
Copy link
Contributor

@vpaskar vpaskar Nov 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use the ErrMaxBytes from nats-server library and use then errors.Is instead of checking for error text ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No we cannot, but i improved the code to evaluate the errorcode returned by the api

@netlify
Copy link

netlify bot commented Nov 17, 2022

🥰 Documentation preview ready! 🥰

Name Link
🔨 Latest commit bf205e2
🔍 Latest deploy log https://app.netlify.com/sites/kyma-project-docs-preview/deploys/63761a2fe67ed70008fd581d
😎 Deploy Preview https://deploy-preview-16115--kyma-project-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@kyma-bot
Copy link
Contributor

@k15r: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-event-publisher-proxy-lint bf205e2 link false /test pull-event-publisher-proxy-lint
pre-main-kyma-skr-eventing bf205e2 link false /test pre-main-kyma-skr-eventing

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Contributor

@friedrichwilken friedrichwilken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@kyma-bot kyma-bot added the lgtm Looks good to me! label Nov 17, 2022
@kyma-bot kyma-bot merged commit ae62e1e into kyma-project:main Nov 17, 2022
@k15r k15r mentioned this pull request Nov 18, 2022
k15r added a commit to k15r/kyma that referenced this pull request Nov 18, 2022
* introduce common errors to allow returning custom http responses

* bump image

* evaluate API Error returned by nats

* fix code review comments
kyma-bot pushed a commit that referenced this pull request Nov 18, 2022
* Change http response code based on backend error (#16115)

* introduce common errors to allow returning custom http responses

* bump image

* evaluate API Error returned by nats

* fix code review comments

* update stream configuration according to env vars (#16111)

* update stream configuration according to env vars

* fix tests

* disable strict shadowing linting, to allow shadowing of `err`

* parse units in maxbytes environment

* fix more tests

* set discardPolicy

* fix review comments

* bump images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/eventing Issues or PRs related to eventing lgtm Looks good to me! size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set Discard policy in combination with MaxBytes stream properties to the stream to avoid full storage in NATS
4 participants