Mercurial Hosting > luan
diff core/src/luan/LuanException.java @ 200:9fb218211763
add Package.block();
add LuanException.getFullMessage();
git-svn-id: https://luan-java.googlecode.com/svn/trunk@201 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 03 Jul 2014 22:22:16 +0000 |
parents | 3dcb0f9bee82 |
children | 5d4a78c93383 |
line wrap: on
line diff
--- a/core/src/luan/LuanException.java Thu Jul 03 21:37:47 2014 +0000 +++ b/core/src/luan/LuanException.java Thu Jul 03 22:22:16 2014 +0000 @@ -1,7 +1,10 @@ package luan; +import java.io.StringWriter; +import java.io.PrintWriter; -public class LuanException extends Exception { + +public final class LuanException extends Exception { private final String stackTrace; LuanException(LuanBit bit,Object msg) { @@ -13,6 +16,18 @@ return super.getMessage() + stackTrace; } + public String getFullMessage() { + String msg = getMessage(); + Throwable cause = getCause(); + if( cause != null ) { + msg += "\nCaused by: "; + StringWriter sw = new StringWriter(); + cause.printStackTrace(new PrintWriter(sw)); + msg += sw; + } + return msg; + } + private String message() { return super.getMessage(); }