001 002 package railo.runtime.exp; 003 004 import railo.runtime.config.Config; 005 import railo.runtime.type.Collection; 006 import railo.runtime.type.KeyImpl; 007 008 /** 009 * 010 * 011 * To change the template for this generated type comment go to 012 * Window>Preferences>Java>Code Generation>Code and Comments 013 */ 014 public class ExpressionException extends PageExceptionImpl { 015 016 private static final Collection.Key ERR_NUMBER = KeyImpl.intern("ErrNumber"); 017 /** 018 * Class Constuctor 019 * @param message error message 020 */ 021 public ExpressionException(String message) { 022 super(message,"expression"); 023 } 024 025 /** 026 * Class Constuctor 027 * @param message error message 028 * @param detail detailed error message 029 */ 030 public ExpressionException(String message, String detail) { 031 super(message,"expression"); 032 setDetail(detail); 033 } 034 035 public CatchBlock getCatchBlock(Config config) { 036 CatchBlock sct=super.getCatchBlock(config); 037 sct.setEL(ERR_NUMBER,new Double(0)); 038 return sct; 039 } 040 /** 041 * @param e 042 * @return pageException 043 */ 044 public static ExpressionException newInstance(Exception e) { 045 if(e instanceof ExpressionException) return (ExpressionException) e; 046 else if(e instanceof PageException) { 047 PageException pe=(PageException)e; 048 ExpressionException ee = new ExpressionException(pe.getMessage()); 049 ee.detail=pe.getDetail(); 050 ee.setStackTrace(pe.getStackTrace()); 051 return ee; 052 } 053 else { 054 ExpressionException ee = new ExpressionException(e.getMessage()); 055 ee.setStackTrace(e.getStackTrace()); 056 return ee; 057 } 058 } 059 }