<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 media-type="json">
        <format>{"code":"$1","type":"Status report","message":"Runtime Error","description":"$2"}</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/json" scope="axis2"/>
    <sequence key="_cors_request_handler_"/>
    <send/>
    <drop/>
</sequence>
