You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2019/06/14 12:06:51 UTC

[kibble-scanners] branch master updated: Raise a ConnectionError, so we can catch it

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble-scanners.git


The following commit(s) were added to refs/heads/master by this push:
     new ff31052  Raise a ConnectionError, so we can catch it
ff31052 is described below

commit ff31052a40eb56b8fbca0fd3971e5a26b38642e8
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Fri Jun 14 14:06:42 2019 +0200

    Raise a ConnectionError, so we can catch it
    
    scanners are expecting a ConnectionError exception on failure,
    so let's make sure we raise that, and don't break scanning.
---
 src/plugins/utils/jsonapi.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/plugins/utils/jsonapi.py b/src/plugins/utils/jsonapi.py
index ecda530..bd10a8c 100644
--- a/src/plugins/utils/jsonapi.py
+++ b/src/plugins/utils/jsonapi.py
@@ -47,7 +47,7 @@ def get(url, cookie = None, auth = None, token = None, retries = 5):
             return get(url, cookie = cookie, auth = auth, token = token, retries = retries)
     if rv.status_code < 400:
         return rv.json()
-    raise Exception("Could not fetch JSON, server responded with status code %u" % rv.status_code)
+    raise requests.exceptions.ConnectionError("Could not fetch JSON, server responded with status code %u" % rv.status_code, response = rv)
 
 def gettxt(url, cookie = None, auth = None):
     """ Same as above, but returns as text blob """