commit 04391b319fd63fb10c6bf925b86796d2d26ec526 Author: Damian Johnson atagar@torproject.org Date: Fri Jan 11 09:07:35 2013 -0800
String explanation for FileSkipped exceptions
For #7828 I wrote a little consenses parser script. That script included a very simple skip listener...
lambda path, exc: LOGGER.warning(" skipped due to %s" % exc)
"How could it fail?" I asked myself. Yet when I just ran it the listener gave me the very helpful warning of "skipped due to ". It turns out that we weren't providing our exceptions with a string explanation - go me. :P --- stem/descriptor/reader.py | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/stem/descriptor/reader.py b/stem/descriptor/reader.py index 9c7bad1..d3e9d2a 100644 --- a/stem/descriptor/reader.py +++ b/stem/descriptor/reader.py @@ -108,7 +108,7 @@ class AlreadyRead(FileSkipped): """
def __init__(self, last_modified, last_modified_when_read): - super(AlreadyRead, self).__init__() + super(AlreadyRead, self).__init__("File has already been read since it was last modified. modification time: %s, last read: %s" % (last_modified, last_modified_when_read)) self.last_modified = last_modified self.last_modified_when_read = last_modified_when_read
@@ -121,7 +121,7 @@ class ParsingFailure(FileSkipped): """
def __init__(self, parsing_exception): - super(ParsingFailure, self).__init__() + super(ParsingFailure, self).__init__(parsing_exception) self.exception = parsing_exception
@@ -134,7 +134,7 @@ class UnrecognizedType(FileSkipped): """
def __init__(self, mime_type): - super(UnrecognizedType, self).__init__() + super(UnrecognizedType, self).__init__("Unrecognized mime type: %s (%s)" % mime_type) self.mime_type = mime_type
@@ -147,7 +147,7 @@ class ReadFailed(FileSkipped): """
def __init__(self, read_exception): - super(ReadFailed, self).__init__() + super(ReadFailed, self).__init__(read_exception) self.exception = read_exception
@@ -155,7 +155,7 @@ class FileMissing(ReadFailed): "File does not exist."
def __init__(self): - super(FileMissing, self).__init__(None) + super(FileMissing, self).__init__("File does not exist")
def load_processed_files(path):
tor-commits@lists.torproject.org