This Error advanced example

Advanced example on catching errors and how to display exception details for specific users.

Smartsite SXML CopyCode image Copy Code
<se:impersonate>
    <se:parameters>
        <se:parameter name="username">admin</se:parameter>
        <se:parameter name="password">*****</se:parameter>
        <se:parameter name="xml">
            <se:text>
                <se:parameters>
                    <se:parameter name="value">
                        {datetime.getdate(9999,15,32)}
                    </se:parameter>
                    <se:parameter name="error">
                        <se:if expression="user.isingroup(Administrators)">
                        <se:then>
                            <strong>An exception has occurred:</strong><br />
                            Message : {this.error.message()}<br/>
                            Code : {this.error.smartsitecode(default='There is no code for this exception.')}<br/>
                            Type : {this.error.type()}
                            <h3>Exception details</h3>
                            <p>{this.error.tostring()}</p>
                        </se:then>
                        <se:else>
                            Exception message = {this.error.message()}<br/>
                            Exception code = {this.error.smartsitecode(default='There is no code for this exception.')}<br/>
                            Exception type = {this.error.type()}<br/>
                        </se:else>
                        </se:if>
                    </se:parameter>
                </se:parameters>
            </se:text>        
        </se:parameter>
    </se:parameters>
</se:impersonate>