0

As the question already asks, I'm aware of building a custom exception class like this:

class MyException(Exception) :

   def __init__(self, message='My error message') :
       self.message = message
       super(MyException, self).__init__(message)

which will build a custom Exception class object with a predefined overwritable message.

I wanted to know if it's possible to define more methods in it, other than __init__, and what would the effects of that be.

Thanks

lupodellasleppa
  • 124
  • 1
  • 1
  • 11

1 Answers1

0

Yes, you can. It won't have any effect other than having those other methods on it.

Keith
  • 42,110
  • 11
  • 57
  • 76