cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "George V. Prascharuk" <chi...@mgn.ru>
Subject XPathExceptionSelector
Date Tue, 02 Aug 2005 15:33:22 GMT
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


Mime
View raw message