When creating an exception class is it okay to only provide a “specific” constructor:
public CircularLinkException(final String msg, final String link)
{
super(msg);
link = inputName;
}
or should I implement the constructors of Exception:
public class CircularLinkException extends Exception
{
public CircularLinkException() { /* ... */ }
public CircularLinkException(final String msg) { /* ... */ }
public CircularLinkException(final Throwable t) { /* ... */ }
public CircularLinkException(final String msg, final Throwable t) { /* ... */ }
}
You should create all the Constructors you will use.
Don’t add code when you imagine a use for something. Add it when you have a requirement for it.
http://c2.com/xp/YouArentGonnaNeedIt.html