kalliope-project / kalliope

Kalliope is a framework that will help you to create your own personal assistant.
https://kalliope-project.github.io/
GNU General Public License v3.0
1.71k stars 230 forks source link

InvalidParameterException: self.message not set #662

Closed juergenpabel closed 2 years ago

juergenpabel commented 3 years ago

Stumbled upon this error, quick bugfix (don't remember where it occured, but some kalliope exception handling code expected an instance variable 'message' for any NeuronExceptions). It would probably be more reasonable to put self.message assignment in NeuronExceptions, but this is the most non-invasive fix.

joshiayush commented 3 years ago

@juergenpabel Base class does not seem to have a constructor defined explicitly.

class NeuronExceptions(Exception):
    pass

If you pass the message variable in the constructor still you are bound to get an error,

class InvalidParameterException(NeuronExceptions):
    """
    Some Neuron parameters are invalid.
    """

    def __init__(self, message):
        # Call the base class constructor with the parameters it needs
        super(InvalidParameterException, self).__init__(message)
        self.message = message

TypeError: object.__init__() takes exactly one argument (the instance to initialize)

So you better fix that and this is not the case with this class only there are other classes as well that will raise the same exception. So if you are interested you should create a PR fixing these issues. Thanks!