• Jim Lerner
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
I'm trying to extend the System.Exception class to add some logging and email functionality.  My interest is in having a constructor like this:

class APException extends Exception {
  public APException(String message) {
    super(message);
    logException();
    mailNotify();
  }
}

This code gives me a compile-time error: System exception constructor already defined: <Constructor>(String, Exception).  

I've even tried adding a dummy argument so that the method signature doesn't match any existing Exception constructor.  That only leads to another error: Object has no superclass for super invocation.

What is the right way to do this?  Or can it not be done?
I'm trying to extend the System.Exception class to add some logging and email functionality.  My interest is in having a constructor like this:

class APException extends Exception {
  public APException(String message) {
    super(message);
    logException();
    mailNotify();
  }
}

This code gives me a compile-time error: System exception constructor already defined: <Constructor>(String, Exception).  

I've even tried adding a dummy argument so that the method signature doesn't match any existing Exception constructor.  That only leads to another error: Object has no superclass for super invocation.

What is the right way to do this?  Or can it not be done?