RFR: 1616: Improve error message when an author isn't found in GitLab

Erik Joelsson erikj at openjdk.org
Wed Oct 5 16:43:02 UTC 2022


On Wed, 5 Oct 2022 16:24:04 GMT, Zhao Song <zsong at openjdk.org> wrote:

> Improved the error message in GitLabMergeRequest:author

forge/src/main/java/org/openjdk/skara/forge/gitlab/GitLabMergeRequest.java line 85:

> 83:             return author.get();
> 84:         } else {
> 85:             throw new IllegalArgumentException("Unknown username: " + username);

I don't think IllegalArgumentException is correct here. It's meant to be thrown when a method receives a bad argument, but this method doesn't take arguments. We don't really have a reason to define a new exception type either, so a plain `RuntimeException` is probably better, at least for now.

I'm usually for short and concise messages, but in this case I think we can add some more details. Something like `"Author of merge request unknown: " + username`

-------------

PR: https://git.openjdk.org/skara/pull/1390


More information about the skara-dev mailing list