]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Rename HTTP{In,Out}putException to HTTP{In,Out}putError.
authorBen Darnell <ben@bendarnell.com>
Mon, 16 Jun 2014 03:39:00 +0000 (23:39 -0400)
committerBen Darnell <ben@bendarnell.com>
Mon, 16 Jun 2014 03:39:00 +0000 (23:39 -0400)
This follows the standard python naming convention for exceptions.

tornado/curl_httpclient.py
tornado/http1connection.py
tornado/httputil.py
tornado/wsgi.py

index c7e4345a6af7a4552523da62494f8963f2084b96..c190ac91d83c15fa7e7ae1266e037933b1681b6c 100644 (file)
@@ -473,7 +473,7 @@ def _curl_header_callback(headers, header_line):
         try:
             (__, __, reason) = httputil.parse_response_start_line(header_line)
             header_line = "X-Http-Reason: %s" % reason
-        except httputil.HTTPInputException:
+        except httputil.HTTPInputError:
             return
     if not header_line:
         return
index dba6a0ab68da0deb569e84e2874fefee44934a8b..c43675a1c392bae82ed0bb5df2c99f0d70fa2099 100644 (file)
@@ -231,7 +231,7 @@ class HTTP1Connection(httputil.HTTPConnection):
                 self.close()
             if self.stream is None:
                 raise gen.Return(False)
-        except httputil.HTTPInputException as e:
+        except httputil.HTTPInputError as e:
             gen_log.info("Malformed HTTP message from %s: %s",
                          self.context, e)
             self.close()
@@ -377,7 +377,7 @@ class HTTP1Connection(httputil.HTTPConnection):
             if self._expected_content_remaining < 0:
                 # Close the stream now to stop further framing errors.
                 self.stream.close()
-                raise httputil.HTTPOutputException(
+                raise httputil.HTTPOutputError(
                     "Tried to write more data than Content-Length")
         if self._chunking_output and chunk:
             # Don't write out empty chunks because that means END-OF-STREAM
@@ -412,7 +412,7 @@ class HTTP1Connection(httputil.HTTPConnection):
                 self._expected_content_remaining != 0 and
                 not self.stream.closed()):
             self.stream.close()
-            raise httputil.HTTPOutputException(
+            raise httputil.HTTPOutputError(
                 "Tried to write %d bytes less than Content-Length" %
                 self._expected_content_remaining)
         if self._chunking_output:
@@ -477,8 +477,8 @@ class HTTP1Connection(httputil.HTTPConnection):
             headers = httputil.HTTPHeaders.parse(data[eol:])
         except ValueError:
             # probably form split() if there was no ':' in the line
-            raise httputil.HTTPInputException("Malformed HTTP headers: %r" %
-                                              data[eol:100])
+            raise httputil.HTTPInputError("Malformed HTTP headers: %r" %
+                                          data[eol:100])
         return start_line, headers
 
     def _read_body(self, headers, delegate):
@@ -486,7 +486,7 @@ class HTTP1Connection(httputil.HTTPConnection):
         if content_length:
             content_length = int(content_length)
             if content_length > self._max_body_size:
-                raise httputil.HTTPInputException("Content-Length too long")
+                raise httputil.HTTPInputError("Content-Length too long")
             return self._read_fixed_body(content_length, delegate)
         if headers.get("Transfer-Encoding") == "chunked":
             return self._read_chunked_body(delegate)
@@ -515,7 +515,7 @@ class HTTP1Connection(httputil.HTTPConnection):
                 return
             total_size += chunk_len
             if total_size > self._max_body_size:
-                raise httputil.HTTPInputException("chunked body too large")
+                raise httputil.HTTPInputError("chunked body too large")
             bytes_to_read = chunk_len
             while bytes_to_read:
                 chunk = yield self.stream.read_bytes(
index 7287b55dade388a46d9d9789461dcdfc66f7e0aa..a67489725587193f9a4b853c28b0cdb206f009a1 100644 (file)
@@ -445,7 +445,7 @@ class HTTPServerRequest(object):
             self.__class__.__name__, args, dict(self.headers))
 
 
-class HTTPInputException(Exception):
+class HTTPInputError(Exception):
     """Exception class for malformed HTTP requests or responses
     from remote sources.
 
@@ -454,7 +454,7 @@ class HTTPInputException(Exception):
     pass
 
 
-class HTTPOutputException(Exception):
+class HTTPOutputError(Exception):
     """Exception class for errors in HTTP output.
 
     .. versionadded:: 4.0
@@ -774,9 +774,9 @@ def parse_request_start_line(line):
     try:
         method, path, version = line.split(" ")
     except ValueError:
-        raise HTTPInputException("Malformed HTTP request line")
+        raise HTTPInputError("Malformed HTTP request line")
     if not version.startswith("HTTP/"):
-        raise HTTPInputException(
+        raise HTTPInputError(
             "Malformed HTTP version in HTTP Request-Line: %r" % version)
     return RequestStartLine(method, path, version)
 
@@ -796,7 +796,7 @@ def parse_response_start_line(line):
     line = native_str(line)
     match = re.match("(HTTP/1.[01]) ([0-9]+) ([^\r]*)", line)
     if not match:
-        raise HTTPInputException("Error parsing response start line")
+        raise HTTPInputError("Error parsing response start line")
     return ResponseStartLine(match.group(1), int(match.group(2)),
                              match.group(3))
 
index 8587862bd02941191382cb291f22dbb40471bf91..6e115e12555b0e339e16601a2a43a65ea4858274 100644 (file)
@@ -126,7 +126,7 @@ class _WSGIConnection(httputil.HTTPConnection):
         if self._expected_content_remaining is not None:
             self._expected_content_remaining -= len(chunk)
             if self._expected_content_remaining < 0:
-                self._error = httputil.HTTPOutputException(
+                self._error = httputil.HTTPOutputError(
                     "Tried to write more data than Content-Length")
                 raise self._error
         self._write_buffer.append(chunk)
@@ -137,7 +137,7 @@ class _WSGIConnection(httputil.HTTPConnection):
     def finish(self):
         if (self._expected_content_remaining is not None and
                 self._expected_content_remaining != 0):
-            self._error = httputil.HTTPOutputException(
+            self._error = httputil.HTTPOutputError(
                 "Tried to write %d bytes less than Content-Length" %
                 self._expected_content_remaining)
             raise self._error