001    package railo.runtime.exp;
002    
003    import railo.runtime.PageContext;
004    import railo.runtime.PageSource;
005    import railo.runtime.config.Config;
006    import railo.runtime.dump.DumpData;
007    import railo.runtime.dump.DumpProperties;
008    import railo.runtime.engine.ThreadLocalPageContext;
009    import railo.runtime.err.ErrorPage;
010    import railo.runtime.type.Struct;
011    
012    /**
013     *
014     *
015     * To change the template for this generated type comment go to
016     * Window - Preferences - Java - Code Generation - Code and Comments
017     */
018    public class PageRuntimeException extends RuntimeException implements IPageException,PageExceptionBox {
019            
020            private PageException pe;
021    
022            
023            /**
024             * constructor of the class
025             * @param pe page exception to hold
026             */
027            public PageRuntimeException(PageException pe) {
028                    super(pe.getMessage());
029                    this.pe=pe;
030            }
031            
032            /**
033             * standart excption constructor
034             * @param message message of the exception
035             */
036            public PageRuntimeException(String message) {
037                    super(message);
038                    this.pe=new ApplicationException(message);
039            }
040            
041            /**
042             * standart excption constructor
043             * @param message message of the exception
044             * @param detail detailed information to the exception
045             */
046            public PageRuntimeException(String message,String detail) {
047                    super(message);
048                    this.pe=new ApplicationException(message,detail);
049            }
050    
051            @Override
052            public String getDetail() {
053                    return pe.getDetail();
054            }
055            
056            @Override
057            public String getErrorCode() {
058                    return pe.getErrorCode();
059            }
060            
061            @Override
062            public String getExtendedInfo() {
063                    return pe.getExtendedInfo();
064            }
065            
066            @Override
067            public CatchBlock getCatchBlock(Config config) {
068                    return pe.getCatchBlock(config);
069            }
070            
071            @Override
072            public Struct getCatchBlock(PageContext pc) {
073                    return pe.getCatchBlock(pc.getConfig());
074            }
075            
076            public Struct getCatchBlock() {
077                    // TLPC
078                    return pe.getCatchBlock(ThreadLocalPageContext.getConfig());
079            }
080            
081            @Override
082            public Struct getErrorBlock(PageContext pc,ErrorPage ep) {
083                    return pe.getErrorBlock(pc,ep);
084            }
085            @Override
086            public void addContext(PageSource template, int line, int column,StackTraceElement ste) {
087                    pe.addContext(template,line,column,ste);
088            }
089            
090            @Override
091            public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
092                    return pe.toDumpData(pageContext, maxlevel,dp);
093            }
094    
095            @Override
096            public PageException getPageException() {
097                    return pe;
098            }
099    
100            @Override
101            public void setDetail(String detail) {
102                             pe.setDetail(detail);
103            }
104    
105            @Override
106            public void setErrorCode(String errorCode) {
107                             pe.setErrorCode(errorCode);            
108            }
109    
110            @Override
111            public void setExtendedInfo(String extendedInfo) {
112                             pe.setExtendedInfo(extendedInfo);              
113            }
114            
115            @Override
116            public boolean typeEqual(String type) {
117                    return  pe.typeEqual(type);
118            }
119            
120            @Override
121            public String getTypeAsString() {
122                    return pe.getTypeAsString();
123            }
124    
125            @Override
126            public String getCustomTypeAsString() {
127                    return pe.getCustomTypeAsString();
128            }
129    
130        @Override
131        public int getTracePointer() {
132            return pe.getTracePointer();
133        }
134    
135        @Override
136        public void setTracePointer(int tracePointer) {
137            pe.setTracePointer(tracePointer);
138        }
139    
140        @Override
141        public Struct getAdditional() {
142            return pe.getAddional();
143        }
144        public Struct getAddional() {
145            return pe.getAddional();
146        }
147    
148        public String getStackTraceAsString() {
149            return pe.getStackTraceAsString();
150        }
151    }