Navigation Menu

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

Print more info when openapi meet a error #307

Closed

Conversation

chengyumeng
Copy link
Collaborator

@chengyumeng chengyumeng commented Feb 25, 2019

/kind feature

使用 OpenAPI 的时候,一些时候会输出一些含混不清的错误信息,例如:内部错误 等,这些错误没有明确表明用户在哪个环节出了错误,因此这个 PR 在这方面做了改进。

同时,优化了一些错误的声明方式,使之更加贴近 Go 建议的表达方式。主要在于,定义错误不要首字母大写,和输出错误信息要区别开。

@chengyumeng chengyumeng added kind/feature Categorizes issue or PR as related to a new feature. sig/openapi labels Feb 25, 2019
logs.Error("Failed to get k8s deployment state: %s", err.Error())
c.AddErrorAndResponse("", http.StatusInternalServerError)
logs.Error("Failed to get k8s deployment state", err.Error())
c.AddErrorAndResponse("Failed to get k8s deployment state:the specified deployment may not exist in the kubernetes cluster.", http.StatusInternalServerError)
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里应该加判断区分错误返回不同的类型,而不是所有的都返回500

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@wilhelmguo kubernetes 的错误如何区分错误类型?

Copy link
Collaborator

Choose a reason for hiding this comment

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

logs.Error("Failed to get k8s pod state: %s", err.Error())
c.AddErrorAndResponse("", http.StatusInternalServerError)
logs.Error("Failed to get k8s pod state", err.Error())
c.AddErrorAndResponse("Failed to get k8s pod state", http.StatusInternalServerError)
Copy link
Collaborator

Choose a reason for hiding this comment

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

同上

@chengyumeng chengyumeng added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. and removed status/done labels Mar 1, 2019
@wilhelmguo wilhelmguo closed this Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants