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

Error handling for registry #499

Merged
merged 12 commits into from
Jun 17, 2024

Conversation

Jougan-0
Copy link
Contributor

@Jougan-0 Jougan-0 commented May 29, 2024

Description

This PR fixes #

Notes for Reviewers

Signed commits

  • Yes, I signed my commits.

Jougan-0 and others added 5 commits May 6, 2024 10:19
Signed-off-by: Jougan-0 <prasantmishra2018@gmail.com>
Signed-off-by: Jougan-0 <prasantmishra2018@gmail.com>
Signed-off-by: Jougan-0 <prasantmishra2018@gmail.com>
@Jougan-0 Jougan-0 mentioned this pull request May 29, 2024
10 tasks
@Jougan-0
Copy link
Contributor Author

meshery/meshery#11065

errors/errors.go Outdated Show resolved Hide resolved
)

func ErrUnknownHost(err error) error {
return errors.New(ErrUnknownHostCode, errors.Alert, []string{"host is not supported"}, []string{err.Error()}, []string{"The component's host is not supported by the version of server you are running"}, []string{"Try upgrading to latest available version"})
}
func ErrUnknownHostInMap() error {
return errors.New(ErrUnknownHostCode, errors.Alert, []string{"Registrant has no error or it is not supported or unknown."}, nil, []string{"The host registering the entites has no errors with it's entites or is unknown."}, []string{"Validate the registrant name again or check /server/cmd/registery_attempts.json for futher details"})
Copy link
Member

Choose a reason for hiding this comment

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

"Registrant has no error...." Hmm. What?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The part needs rephrasing did it .
The error is resulted when we access the map of the attempts variable with different registrants and it does not contain that registrant so it shouldn't do anything but vihas mentioned that it might panic so the error is for that. I haven't seen this edge case ever happened so I think this is void but still good to have a error if it happens.

Jougan-0 and others added 4 commits May 30, 2024 18:31
Signed-off-by: Jougan-0 <prasantmishra2018@gmail.com>
Signed-off-by: Shlok Mishra <99207534+Jougan-0@users.noreply.github.com>
Signed-off-by: Jougan-0 <prasantmishra2018@gmail.com>
@Jougan-0
Copy link
Contributor Author

Jougan-0 commented Jun 3, 2024

While testing the fix of panic error the error code was being shown as None event though it existed. New commit should fix it.

@Jougan-0
Copy link
Contributor Author

Jougan-0 commented Jun 3, 2024

Should fix this issue too.

errors/errors.go Outdated
defer func() {
if r := recover(); r != nil {
severity = None
fmt.Println("Recovered from panic:", r)
Copy link
Member

Choose a reason for hiding this comment

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

I don't know that this is necessary and, at first glance, it seems redundant or not insightful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for mentioning it was redundant, by mistake I pushed defer on top the assertion logic .
Reason behind using anonymous function is the assertion logic, which I used was giving NONE on meshkit errors that existed when I released my local meshkit release and used it in go.mod but working fine for local meshkit so new logic is that if we get a panic rather than panic and shutting down the process we catch the panic and returns old value.

Jougan-0 added 2 commits June 5, 2024 05:12
Signed-off-by: Jougan-0 <prasantmishra2018@gmail.com>
Signed-off-by: Jougan-0 <prasantmishra2018@gmail.com>
@leecalcote
Copy link
Member

@Jougan-0 will you reconcile the two different error codes for ErrRegisterEntityCode?

Signed-off-by: Shlok Mishra <99207534+Jougan-0@users.noreply.github.com>
@leecalcote leecalcote merged commit 761df57 into meshery:master Jun 17, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants