<sequence xmlns="http://ws.apache.org/ns/synapse" name="_token_fault_">
    <log level="custom">
        <property name="STATUS" value="Executing token 'fault' sequence"/>
        <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
        <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
    </log>
    <payloadFactory>
        <format>
            <am:fault xmlns:am="http://wso2.org/apimanager">
                <am:code>$1</am:code>
                <am:type>Status report</am:type>
                <am:message>Runtime Error</am:message>
                <am:description>$2</am:description>
            </am:fault>
        </format>
        <args>
            <arg expression="$ctx:ERROR_CODE"/>
            <arg expression="$ctx:ERROR_MESSAGE"/>
        </args>
    </payloadFactory>
    <filter xpath="$ctx:CUSTOM_HTTP_SC">
        <then>
            <property name="HTTP_SC" expression="$ctx:CUSTOM_HTTP_SC" scope="axis2"/>
        </then>
        <else>
            <property name="HTTP_SC" value="500" scope="axis2"/>
        </else>
    </filter>
    <property name="RESPONSE" value="true"/>
    <header name="To" action="remove"/>
    <property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
    <property name="ContentType" scope="axis2" action="remove"/>
    <property name="Authorization" scope="transport" action="remove"/>
    <property name="Host" scope="transport" action="remove"/>
    <property name="Accept" scope="transport" action="remove"/>
    <property name="messageType" value="application/xml" scope="axis2"/>
    <sequence key="_cors_request_handler_"/>
    <send/>
    <drop/>
</sequence>
