jcabi / jcabi/jcabi-github

Error messages are not meaningful and requests are not validated

Open
#1,203 2 comments 0 reactions 0 assignees View on GitHub
bug DEV
Dominant language
Java
Stars
307
Forks
144
Avg merge
1d 22h
Merged PRs (30d)
14

Description

I was just trying to figure out how search API works and I wrote the following code:

``` java
Github github = new RtGithub("key");
github.search().issues(
"", "", Search.Order.ASC,
new EnumMap(Search.Qualifier.class)
).iterator().next();
```

Upon execution it throws exception:

```
Exception in thread "main" java.lang.AssertionError: HTTP response status is not equal to 200:
com.jcabi.github.RtSearchPagination$Hidden@4f209819
Expected: HTTP response with status 200
but: was
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at com.jcabi.http.response.RestResponse.assertStatus(RestResponse.java:117)
at com.jcabi.github.RtValuePagination$Items.fetch(RtValuePagination.java:199)
at com.jcabi.github.RtValuePagination$Items.hasNext(RtValuePagination.java:185)
at com.jcabi.github.RtValuePagination$Items.next(RtValuePagination.java:167)
at Main.main(Main.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
```

I see that status was not equal to 200, so what return code it was? Moreover, I think we should have some basic validation of arguments of `issues` method to not have information what is wrong before sending actual request.

There's one more unclear thing for me: what is the purpose of argument `String sort` in `com.jcabi.github.Search#issues`? Javadoc is not helpful, it states only that it is `The sort field`, but what kind of field it is?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.