Community
Participate
Working Groups
I'm trying to provide some meaningful feedback to the end user when he makes attempts to create a repository using the GitHub v3 API. It's a bit hard to make sense of the exception that I get when a repository by the given name already exists. The JSon output from GitHub looks like this: {"message":"Validation Failed","errors":[{"field":"name","message":"name is already taken","code":"custom","resource":"Repository"}]} which seems OK. But the RequestException that I get back will only print: "Validation Failed (422): Error with 'name' field in Repository resource" In the RequestException there's a RequestError with a list containing one FieldError. The field error lacks a message field and hence contains only: {"field":"name","code":"custom","resource":"Repository"} I think the problem is twofold. First of all, the 'message' field should be added to the FieldError class, second, an issue should be reported against the Git v3 API that the code = "custom" is inconsistent. According to the documentation [1], it should really be "already_exists" [1] http://developer.github.com/v3/#client-errors
Patch added: http://egit.eclipse.org/r/#change,4292
Have you tried calling RequestException.getError().getMessage()? I think that provides the message you are looking for.
No, it just prints "Validation Failed" A sent a note about the inconsistent code to github support.
Yes, you are right, the nested message is missing from the field error.
I meant to write "inconsistent code attribute". The actual code is consistent enough :-)
Merged into master as commit 706fa65b8ee1f2d1b14863af21ced8dd9fe9f582