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

gitsources: improve error reporting #145

Open
sgotti opened this issue Oct 22, 2019 · 5 comments
Open

gitsources: improve error reporting #145

sgotti opened this issue Oct 22, 2019 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@sgotti
Copy link
Member

sgotti commented Oct 22, 2019

Currently when an errors occurs inside a gitsource method it's considered as a generic error and reported to api clients as an internal server error masking the error message. So some agola cli commands will just report a generic "internal server error" instead of the real error when the user provides some wrong options that are passed to the git sources.

We can do two things:

  • Handle all the gitsources errors as generic errors that can be reported to the api users
  • Improve the gitsources api to report different kind of errors (internal, user etc...) like already done by the actions errors.
@sgotti sgotti added the enhancement New feature or request label Oct 22, 2019
@alessandro-sorint
Copy link
Contributor

@sgotti I don't understand this card because I see the gitsources api just returns custom errors. I don't see git generic errors when I call gateway api client, what we have to do?

@sgotti
Copy link
Member Author

sgotti commented Feb 19, 2022

@alessandro-sorint Take a look at the methods calling a gitsource. You'll see that the gitsource error is wrapped in a generic error that will become a 500 when called by the api. Anyway this is something that requires thorough reasoning before implementing something. I'll come back to this later if/when needed.

@sgotti sgotti self-assigned this Feb 19, 2022
@alessandro-sorint
Copy link
Contributor

@alessandro-sorint Take a look at the methods calling a gitsource. You'll see that the gitsource error is wrapped in a generic error that will become a 500 when called by the api. Anyway this is something that requires thorough reasoning before implementing something. I'll come back to this later if/when needed.

I think we can use the ErrInternal in util package or create and use a new ErrGitea and user it?
With ErrInternal or ErrGitea the api will report the gitea error message and with 500 http code(we can use a different code?)

@sgotti
Copy link
Member Author

sgotti commented Feb 21, 2022

@alessandro-sorint This isn't related to the implementation but to understand how to convert gitsources errors to the errors reported to the user. Which remote sources errors should be reported to the user? Which not? How to map the different gitsource types errors (gitea, github, gitlab) to a set of agola errors? etc...

I think we can use the ErrInternal

ErrInternal is the same as returning a generic error.

@alessandro-sorint
Copy link
Contributor

@alessandro-sorint This isn't related to the implementation but to understand how to convert gitsources errors to the errors reported to the user. Which remote sources errors should be reported to the user? Which not? How to map the different gitsource types errors (gitea, github, gitlab) to a set of agola errors? etc...

I think we can use the ErrInternal

ErrInternal is the same as returning a generic error.

@sgotti for the types of errors I guess maybe you mean the various http 400,500 etc. how to map them
I've seen which of these are returned by gitsources gitea/github/gitlab api: 403, 404, 409, 422, 500, 503
Of these I think it is worth making the user see the error 403 (unauthorized), 404 (not found), 422 (Unprocessable Entity) and 503 (service unavailable).
I need gitea sdk updated bacause at the moment it not returns the http status code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants