Mercurial Hosting > luan
changeset 1122:e15be31cee92
remove LuanException.getFullMessage()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 14 Aug 2017 17:00:37 -0600 |
parents | 4cf541886663 |
children | f2eb8295033f |
files | src/luan/LuanException.java src/luan/modules/http/LuanHandler.java |
diffstat | 2 files changed, 5 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/src/luan/LuanException.java Fri Aug 11 17:57:52 2017 -0600 +++ b/src/luan/LuanException.java Mon Aug 14 17:00:37 2017 -0600 @@ -47,6 +47,9 @@ table.rawPut( "throw", new LuanJavaFunction( LuanException.class.getMethod( "throwThis" ), this ) ); + table.rawPut( "get_stack_trace_string", new LuanJavaFunction( + LuanException.class.getMethod( "getLuanStackTraceString" ), this + ) ); table.rawPut( "get_java_stack_trace_string", new LuanJavaFunction( LuanException.class.getMethod( "getJavaStackTraceString" ), this ) ); @@ -65,37 +68,7 @@ } public String __to_string(LuanTable ignore) { - return getFullMessage(); - } - - public String getFullMessage() { return getLuanStackTraceString(); -// return getLuanStackTraceString()+"\n"+getJavaStackTraceString(); -/* - StringBuilder buf = new StringBuilder(); - - Object msg = table.rawGet("message"); - String msgStr = (String)table.rawGet("message_string"); - buf.append( msgStr ); - - for( int i = table.rawLength(); i>=1; i-- ) { - LuanTable tbl = (LuanTable)table.rawGet(i); - buf.append( "\n\t" ).append( tbl.rawGet("source") ).append( " line " ).append( tbl.rawGet("line") ); - Object callTo = tbl.rawGet("call_to"); - if( callTo != null ) - buf.append( " in call to '" ).append( callTo ).append( "'" ); - } - - if( msg instanceof Throwable ) { - buf.append( "\nCaused by: " ); - Throwable cause = (Throwable)msg; - StringWriter sw = new StringWriter(); - cause.printStackTrace(new PrintWriter(sw)); - buf.append( sw ); - } - - return buf.toString(); -*/ } public String getJavaStackTraceString() {
--- a/src/luan/modules/http/LuanHandler.java Fri Aug 11 17:57:52 2017 -0600 +++ b/src/luan/modules/http/LuanHandler.java Mon Aug 14 17:00:37 2017 -0600 @@ -65,7 +65,7 @@ return; } catch(LuanException e) { //e.printStackTrace(); - String err = e.getFullMessage(); + String err = e.getLuanStackTraceString(); logger.error(err); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,err); } finally { @@ -146,7 +146,7 @@ try { PackageLuan.load(luan,"site:/init.luan"); } catch(LuanException e) { - String err = e.getFullMessage(); + String err = e.getLuanStackTraceString(); logger.error(err); } }