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

return 404 code when delete not exist experiment #93

Closed
WangXiangUSTC opened this issue Sep 16, 2021 · 0 comments · Fixed by #96
Closed

return 404 code when delete not exist experiment #93

WangXiangUSTC opened this issue Sep 16, 2021 · 0 comments · Fixed by #96
Assignees

Comments

@WangXiangUSTC
Copy link
Collaborator

now will get an error when delete not exist experiment:

$ curl -X DELETE 127.0.0.1:31767/api/attack/1234
{"error":true,"message":"error.api.internal_server_error: record not found","code":"error.api.internal_server_error","full_text":"error.api.internal_server_error: record not found\n at github.com/chaos-mesh/chaosd/pkg/server/httpserver.handleError()\n\t/home/xiang/chaosd/pkg/server/httpserver/server.go:227\n at github.com/chaos-mesh/chaosd/pkg/server/httpserver.(*httpServer).recoverAttack()\n\t/home/xiang/chaosd/pkg/server/httpserver/server.go:216\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161\n at github.com/chaos-mesh/chaosd/pkg/server/utils.MWHandleErrors.func1()\n\t/home/xiang/chaosd/pkg/server/utils/error.go:46\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161\n at github.com/gin-gonic/gin.RecoveryWithWriter.func1()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/recovery.go:83\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161\n at github.com/gin-gonic/gin.LoggerWithConfig.func1()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/logger.go:241\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161\n at github.com/gin-gonic/gin.(*Engine).handleHTTPRequest()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/gin.go:409\n at github.com/gin-gonic/gin.(*Engine).ServeHTTP()\n\t/home/xiang/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/gin.go:367\n at net/http.serverHandler.ServeHTTP()\n\t/usr/local/go/src/net/http/server.go:2887\n at net/http.(*conn).serve()\n\t/usr/local/go/src/net/http/server.go:1952\n at runtime.goexit()\n\t/usr/local/go/src/runtime/asm_amd64.s:1371"}

it's better to return 404 status code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant