Browse Source

Set last_error on error

Alois Mahdal 11 years ago
parent
commit
3aea57f3b0
1 changed files with 3 additions and 0 deletions
  1. 3
    0
      lib/htlogr.py

+ 3
- 0
lib/htlogr.py View File

37
         self.url = url
37
         self.url = url
38
         self.parsed_url = urlparse.urlparse(url)
38
         self.parsed_url = urlparse.urlparse(url)
39
         self.conn = httplib.HTTPConnection(self.parsed_url.hostname)
39
         self.conn = httplib.HTTPConnection(self.parsed_url.hostname)
40
+        self.last_error = None
40
 
41
 
41
     def _zipup_params(self, params):
42
     def _zipup_params(self, params):
42
         args = []
43
         args = []
57
         params = {"msg": msg, "tag": tag, "i": i}
58
         params = {"msg": msg, "tag": tag, "i": i}
58
         pq = "%s?%s" % (self.parsed_url.path, self._zipup_params(params))
59
         pq = "%s?%s" % (self.parsed_url.path, self._zipup_params(params))
59
         self.conn.request("GET", pq)
60
         self.conn.request("GET", pq)
61
+        self.last_error = None
60
         return_msg = None
62
         return_msg = None
61
         try:
63
         try:
62
             r = self.conn.getresponse()
64
             r = self.conn.getresponse()
66
         except httplib.BadStatusLine as e:
68
         except httplib.BadStatusLine as e:
67
             return_msg = ("httplib does not like this line:\n\n    %s"
69
             return_msg = ("httplib does not like this line:\n\n    %s"
68
                           % e.line)
70
                           % e.line)
71
+            self.last_error = return_msg
69
         return return_msg
72
         return return_msg
70
 
73
 
71
     def data(self, data, tag=None, i=None):
74
     def data(self, data, tag=None, i=None):