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

Unstructured and ambiguous gosdk errors #371

Open
lpoli opened this issue Feb 12, 2022 · 0 comments
Open

Unstructured and ambiguous gosdk errors #371

lpoli opened this issue Feb 12, 2022 · 0 comments
Labels

Comments

@lpoli
Copy link
Contributor

lpoli commented Feb 12, 2022

We have errors repo. Its error format is:

type Error struct {
	Code string `json:"code,omitempty"`
	Msg  string `json:"msg"`
}

In gosdk this structure should be used everywhere possible especially when it comes to response gosdk gives to other tools that is using it. Somewhere golang's standard errors package is used, somewhere errors.Throw is used, somewhere above structure is used.

Improper error response should be modified too. For example, on downloadFile function, if all blobbers returns error response then error returned by gosdk is File content didn't match with the content uploaded. We can't make anything out of it as it is ambiguous.

This inconsistency makes it harder to handle errors for tools using gosdk.

Please also check for draft PR. Having constants as error code is standard practice.

We can take references from popular repos.

  1. https://github.com/minio/minio/blob/master/cmd/api-errors.go
@lpoli lpoli added enhancement New feature or request refactor labels Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants