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

Expose a storage.ErrNotExists for non existing documents #3083

Closed
bon-ami opened this issue Jun 20, 2022 · 4 comments
Closed

Expose a storage.ErrNotExists for non existing documents #3083

bon-ami opened this issue Jun 20, 2022 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers Hacktoberfest Issues that count towards Hacktoberfest scores.

Comments

@bon-ami
Copy link

bon-ami commented Jun 20, 2022

Is your feature request related to a problem? Please describe:

My code cannot check an error returned by, such as app.Storage().Save() with errors.Is()

Is it possible to construct a solution with the existing API?

Such as return os.ErrNotExist for document with name * does not exist

Describe the solution you'd like to see:

Please use standard errors from Go packages instead of using errors.New()

@andydotxyz
Copy link
Member

I'm not sure that I would agree that a document not existing is an os.ErrNotExist error.
However it is true that we could use sentinel / defined error types better.

We could add a Exists to Docs I guess, but the list of available documents is returned by List.

@andydotxyz andydotxyz added the information-needed Further information is requested label Jun 20, 2022
@Jacalz
Copy link
Member

Jacalz commented Jun 20, 2022

We might want tot just create our own storage.ErrNotExists variable (or similar) and then just return that instead. That would solve the issue presented here.

@bon-ami
Copy link
Author

bon-ami commented Jun 27, 2022

We might want tot just create our own storage.ErrNotExists variable (or similar) and then just return that instead. That would solve the issue presented here.

sounds great

@andydotxyz andydotxyz added enhancement New feature or request and removed information-needed Further information is requested labels Jun 27, 2022
@Jacalz Jacalz added good first issue Good for newcomers Hacktoberfest Issues that count towards Hacktoberfest scores. labels Sep 30, 2022
@Jacalz Jacalz changed the title use standard errors in internal/docs.go Expose a storage.ErrNotExists for non existing documents Sep 30, 2022
@andydotxyz
Copy link
Member

Ready for next release on develop branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers Hacktoberfest Issues that count towards Hacktoberfest scores.
Projects
None yet
Development

No branches or pull requests

3 participants