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

Use pre-defined error instances #13

Closed
shazow opened this issue Nov 1, 2015 · 5 comments
Closed

Use pre-defined error instances #13

shazow opened this issue Nov 1, 2015 · 5 comments

Comments

@shazow
Copy link

shazow commented Nov 1, 2015

Hiya, right now there are a bunch of errors.New(fmt.Sprintf(...)) all over the code, and the string is often dynamic so it makes it hard to compare conditions programmatically.

For instance, when an object is not found: https://github.com/gogits/git/blob/16f4de6a9d8a6695826ef4118f58dff85174b335/repo_object.go#L81

I propose we pull out at least the more common errors into package variables so that the conditions can be compared against. We can still make the Error() messages dynamically generated, so the output will stay the same.

(Happy to work on a PR for this, just let me know!)

@unknwon
Copy link
Member

unknwon commented Nov 1, 2015

Hi there,

This repository is kind of suspend for maintenance, but may continue in the future.

Hmm... so the point is I don't want waste your time. 😓

@shazow
Copy link
Author

shazow commented Nov 1, 2015

Would you recommend not using this? Do you have suggestions for an alternative? Should I start my own fork? :)

@unknwon
Copy link
Member

unknwon commented Nov 1, 2015

Would you recommend not using this?

Code most likely is not going to change.

Should I start my own fork?

Yes, I think so.

@shazow
Copy link
Author

shazow commented Nov 1, 2015

Very well, thanks for letting me know, and thanks for the great work so far!

@unknwon
Copy link
Member

unknwon commented Nov 1, 2015

:trollface: Gogs currently is using git-shell, may come back to manipulate internal objects after 1.0 release when we got enough time

@unknwon unknwon closed this as completed Nov 1, 2015
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

No branches or pull requests

2 participants