1 package net.sf.saxon.trans; 2 3 import net.sf.saxon.expr.XPathContext; 4 5 import javax.xml.transform.SourceLocator ; 6 import javax.xml.transform.TransformerException ; 7 8 11 12 public class DynamicError extends XPathException { 13 14 XPathContext context; 15 17 public DynamicError(String message) { 18 super(message); 19 } 20 21 public DynamicError(Throwable err) { 22 super(err); 23 } 24 25 public DynamicError(String message, Throwable err) { 26 super(message, err); 27 } 28 29 public DynamicError(String message, SourceLocator loc) { 30 super(message, loc); 31 } 32 33 public DynamicError(String message, SourceLocator loc, Throwable err) { 34 super(message, loc, err); 35 } 36 37 public void setXPathContext(XPathContext context) { 38 this.context = context; 39 } 40 41 public XPathContext getXPathContext() { 42 return context; 43 } 44 45 public static DynamicError makeDynamicError(TransformerException err) { 46 if (err instanceof DynamicError) { 47 return (DynamicError)err; 48 } else if (err instanceof XPathException) { 49 DynamicError de = new DynamicError(err); 50 de.setErrorCode(((XPathException)err).getErrorCodeLocalPart()); 51 de.setLocator(err.getLocator()); 52 return de; 53 } else { 54 return new DynamicError(err); 55 } 56 } 57 } 58 | Popular Tags |