Mercurial Hosting > luan
changeset 689:51a134a8c89b
fix LuanException
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 18 Apr 2016 17:02:16 -0600 |
parents | f99f51bc5bea |
children | 6a489a6b3cbc |
files | core/src/luan/LuanException.java |
diffstat | 1 files changed, 23 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
diff -r f99f51bc5bea -r 51a134a8c89b core/src/luan/LuanException.java --- a/core/src/luan/LuanException.java Mon Apr 18 15:46:05 2016 -0600 +++ b/core/src/luan/LuanException.java Mon Apr 18 17:02:16 2016 -0600 @@ -6,32 +6,44 @@ import java.util.ArrayList; -public final class LuanException extends Exception { +public final class LuanException extends Exception implements DeepCloneable { + private LuanTable table; public LuanException(String msg,Throwable cause) { super(msg,cause); + initTable(); } public LuanException(String msg) { super(msg); + initTable(); } public LuanException(Throwable cause) { super(cause); + initTable(); + } + + private LuanException(String msg,Throwable cause,int nonsense) { + super(msg,cause); + } + + @Override public LuanException shallowClone() { + return new LuanException(getMessage(),getCause(),99); + } + + @Override public void deepenClone(DeepCloneable dc,DeepCloner cloner) { + LuanException clone = (LuanException)dc; + clone.table = (LuanTable)cloner.get(table); } public LuanTable table() { - LuanTable table = new LuanTable(); + return table; + } + + private void initTable() { + table = new LuanTable(); table.rawPut( "java", this ); -/* - for( StackTraceElement ste : luan.stackTrace ) { - LuanTable tbl = new LuanTable(); - tbl.rawPut( "source", ste.call.source.name ); - tbl.rawPut( "line", ste.call.lineNumber() ); - tbl.rawPut( "call_to", ste.fnName ); - table.rawPut( table.rawLength() + 1, tbl ); - } -*/ LuanTable metatable = new LuanTable(); table.setMetatable(metatable); try { @@ -50,7 +62,6 @@ } catch(NoSuchMethodException e) { throw new RuntimeException(e); } - return table; } public void throwThis() throws LuanException {