java - How can I change what printStacktrace() does for Exception? -
i have tried making new class extending exception , overriding printstacktrace. problem is, when seek thr following, error "unreachable grab block loggerexception. exception never thrown seek statement body"
public class loggerexception extends throwable {
private static final long serialversionuid = 1l; @override public void printstacktrace() { // todo auto-generated method stub super.printstacktrace(); logger logger = logger.getlogger("custom app exception"); logger.log(level.warning,getmessage(),this); } } seek { //do throw anything. incase there null pointer or } grab (loggerexception e) { // error: unreachable grab block loggerexception. exception never thrown seek statement body e.printstacktrace(); }
you should extend runtimeexception class
java google-app-engine exception
No comments:
Post a Comment