1 23 24 package transactionsDiscRack.presentation; 25 26 import com.lutris.logging.*; 27 import com.lutris.appserver.server.httpPresentation.*; 28 import com.lutris.appserver.server.*; 29 import java.io.*; 30 31 36 public class ErrorHandler implements HttpPresentation { 37 38 44 public void run(HttpPresentationComms comms) 45 throws HttpPresentationException { 46 47 ErrorHTML errorPage = (ErrorHTML)comms.xmlcFactory.create(ErrorHTML.class); 48 50 if(null != comms.exception) { 51 StringWriter stringWriter = new StringWriter(); 52 comms.exception.printStackTrace(new PrintWriter(stringWriter)); 53 LogChannel logChannel = Enhydra.getLogChannel(); 54 int level = logChannel.getLevel("DEBUG"); 55 56 logChannel.write(level, "transactionsDiscRack.presentation.ErrorHandler stack trace = "); 57 logChannel.write(level, stringWriter.toString()); 58 logChannel.write(level, "transactionsDiscRack.presentation.ErrorHandler caught an exception - " 59 + comms.exception.toString(), comms.exception); 60 errorPage.setTextStackTrace(stringWriter.toString()); 61 String m = comms.exception.getMessage(); 62 if (null == m) 63 m = "NULL message"; 64 errorPage.setTextErrorMessage(m); 65 } 66 67 comms.response.writeHTML(errorPage.toDocument()); 68 } 69 } 70 | Popular Tags |