Exceptions now store messages in self.msg directly.

Previously, they had a msg() method for fetching the error string. This
has now been removed in favor of the directly callable attribute.
This commit is contained in:
Adam Waldenberg 2013-07-14 04:57:32 +02:00
parent cf63af8819
commit 291761e6a4
2 changed files with 6 additions and 12 deletions

View file

@ -32,12 +32,9 @@ DEFAULT_FORMAT = __available_formats__[2]
__selected_format__ = DEFAULT_FORMAT __selected_format__ = DEFAULT_FORMAT
class InvalidFormatError(Exception): class InvalidFormatError(Exception):
def __init__(self, message): def __init__(self, msg):
super(InvalidFormatError, self).__init__(message) super(InvalidFormatError, self).__init__(msg)
self.message = message self.msg = msg
def msg(self):
return self.message
def select(format): def select(format):
global __selected_format__ global __selected_format__

View file

@ -20,12 +20,9 @@ from __future__ import unicode_literals
import getopt import getopt
class InvalidOptionArgument(Exception): class InvalidOptionArgument(Exception):
def __init__(self, message): def __init__(self, msg):
super(InvalidOptionArgument, self).__init__(message) super(InvalidOptionArgument, self).__init__(msg)
self.message = message self.msg = msg
def msg(self):
return self.message
def __find_arg_in_options__(arg, options): def __find_arg_in_options__(arg, options):
for opt in options: for opt in options: