lib/github/curl: fix error message matching
authorAlexandre Terrasa <alexandre@moz-code.org>
Fri, 18 Nov 2016 22:53:11 +0000 (17:53 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Mon, 13 Feb 2017 02:54:12 +0000 (21:54 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

lib/github/github_curl.nit

index f2d5737..026456c 100644 (file)
@@ -53,7 +53,7 @@ class GithubCurl
                if response isa CurlResponseSuccess then
                        var obj = response.body_str.parse_json
                        if obj isa JsonObject then
-                               if obj.keys.has("message") then
+                               if obj.keys.has("message") and obj.keys.has("documentation_url") then
                                        print "Message from Github API: {obj["message"] or else ""}"
                                        print "Requested URI: {uri}"
                                        abort
@@ -83,7 +83,7 @@ class GithubCurl
                if response isa CurlResponseSuccess then
                        var obj = response.body_str.parse_json
                        if obj isa JsonObject then
-                               if obj.keys.has("message") then
+                               if obj.keys.has("message") and obj.keys.has("documentation_url") then
                                        var title = "GithubAPIError"
                                        var msg = obj["message"].as(not null).to_s
                                        var err = new GithubError(msg, title)