String cName = (pool == null) ? toString() : toString(pool);
boolean isCCE = (exe instanceof ClassCastException);
if (exe instanceof NullPointerException || item == null || isCCE) {
String appendText = " is " + ((isCCE)? "not a node" : "undefined");
String code = (isCCE)? "XPTY0020" : "XPDY0002";
XPathException err = new XPathException("The context item for axis step " +
cName + appendText);
err.setErrorCode(code);
err.setXPathContext(context);
err.setLocator(getSourceLocator());
err.setIsTypeError(true);
throw err;
} else { // if (exe instanceof UnsupportedOperationException) {
if (exe.getCause() instanceof XPathException) {
XPathException ec = (XPathException)exe.getCause();
ec.maybeSetLocation(getSourceLocator());
ec.maybeSetContext(context);
throw ec;
} else {
// the namespace axis is not supported for all tree implementations
dynamicError("Axis Expression Error on: " + cName + " " + exe.getMessage(), "XPST0010", context);
return null;