gitbucket icon indicating copy to clipboard operation
gitbucket copied to clipboard

Provide user-friendly error message in Web API

Open gjb1002 opened this issue 4 years ago • 5 comments

Issue

Impacted version: 4.33

Deployment mode: Apache Tomcat

Problem description: I try to create an organization using the API, as described in https://developer.github.com/v3/repos/#create-an-organization-repository

If I mistype the organization name and provide one that doesn't exist, I don't get a nice error message. I get "Internal Server Error 500" and an exception in the log, which starts with "java.util.NoSuchElementException: None.get"

gjb1002 avatar Aug 13 '20 08:08 gjb1002

For sure, there is lack of user-friendly error message on Web APIs...

takezoe avatar Aug 13 '20 23:08 takezoe

I don't get it. Why would a web API not have error handling? Or at least the log have a comprehensible message? This kind of thing saves masses of time for new users.

gjb1002 avatar Aug 14 '20 06:08 gjb1002

You're right. It's simply due to the lack of development resource. Initially, because Web API was not a core feature of GitBucket, we started implementing it with minimum effort. Therefore, we didn't prepare a designed validation mechanism which allows providing user-friendly error messages at the beginning.

The consistent design for the error handling in the entire Web API should be done first. Recently, the number of users of Web API is increasing and we get many feedback and requests to Web API. So, it may be a time to invest in Web API improvement.

takezoe avatar Aug 14 '20 12:08 takezoe

OK, I see. Perhaps "Invalid" isn't the best label then. The Web API may not be a core feature, but for anyone migrating a non-trivial number of existing repositories from some other tool it's almost the first thing you use, as in my case.

gjb1002 avatar Aug 14 '20 13:08 gjb1002

Updated label and title.

takezoe avatar Aug 15 '20 01:08 takezoe