You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "George V. Prascharuk" <ch...@mgn.ru> on 2005/08/02 17:33:22 UTC
XPathExceptionSelector
Hi everybody!
Sorry for my bad English.
I have a problem with XPathExceptionSelector. I am try to make error
handling using this selector.
I have a exception class
public class NewInstanceException extends CommonException
{
public NewInstanceException(String message, int error_code)
{
super(message, error_code);
}
}
public class CommonException extends Exception
{
private String message;
private int error_code;
public CommonException(String message, int error_code)
{
this.message=message;
this.error_code=error_code;
}
public String getMessage()
{
return message;
}
public Integer getErrorCode()
{
System.out.println("getErrorCode. Code="+error_code+". Message="+message);
return new Integer(error_code);
}
}
The NewInstanceException exception is throws in Javascript act.
This is a part of my sitemap.xmap
<map:components>
<map:selectors>
<map:selector name="fsm-exception" src="org.apache.cocoon.selection.XPathExceptionSelector" logger="sitemap.selector.fsm-exception">
<exception name="FSM_new_exception" class="com.mindtech.cocoonfsm.webapp.exceptions.statecontrol.NewInstanceException">
<xpath name="no_init_state" test="errorCode=-1"/>
<xpath name="sql_error" test="errorCode=-10"/>
</exception>
</map:selector>
</map:selectors>
</map:components>
Error handling...
<map:handle-errors>
<map:select type="fsm-exception">
<map:when test="no_init_state">
<map:generate src="cocoon://{global:app-path}/errors/global/statecontrol-desc.xml"/>
<map:transform src="../../common/xslt/error.xsl">
<map:parameter name="exception" value="NewInstanceException"/>
<map:parameter name="error-code" value="-1"/>
<map:parameter name="machine-code" value="100"/>
</map:transform>
<map:serialize type="xml"/>
</map:when>
<map:when test="sql_error">
<map:generate src="cocoon://{global:app-path}/errors/global/statecontrol-desc.xml"/>
<map:transform src="../../common/xslt/error.xsl">
<map:parameter name="exception" value="NewInstanceException"/>
<map:parameter name="error-code" value="-10"/>
<map:parameter name="machine-code" value="100"/>
</map:transform>
<map:serialize type="xml"/>
</map:when>
<map:otherwise>
<map:generate src="cocoon://{global:app-path}/errors/global/statecontrol-desc.xml"/>
<map:transform src="../../common/xslt/error.xsl">
<map:parameter name="machine-code" value="1000"/>
<map:parameter name="exception" value="NewInstanceException"/>
<map:parameter name="error-code" value="-2"/>
</map:transform>
<map:serialize type="xml"/>
</map:otherwise>
</map:select>
</map:handle-errors>
The problem now. I am ALWAYS come to the branch <map:otherwise>.
I am read an example in Cocoon documentation and make the same...
Please help me...
--
With a best wishes
George V. Prascharuk mailto:chidar@mgn.ru
Russia, Magnitogorsk
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org