"Handling Errors"

morix77
morix77 New Altair Community Member
edited November 5 in Altair RapidMiner
Hi,
I ask for advice on handling errors in Rapidminer.

In the code below you can find a process that is deliberately in error controlled , I used to do this "Handle Exception" and "Branch".

it is correct or is there a better way?


There is also the possibility of having an error code instead of just the description? if yes how?


Sorry for my English but Google is my friend
Morix


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.1.008">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.1.008" expanded="true" name="Process">
    <process expanded="true" height="386" width="681">
      <operator activated="true" class="retrieve" compatibility="5.1.008" expanded="true" height="60" name="Retrieve" width="90" x="45" y="210">
        <parameter key="repository_entry" value="//Samples/data/Iris"/>
      </operator>
      <operator activated="true" class="handle_exception" compatibility="5.1.008" expanded="true" height="76" name="Handle Exception" width="90" x="179" y="210">
        <parameter key="exception_macro" value="error_name"/>
        <process expanded="true" height="404" width="873">
          <operator activated="true" class="store" compatibility="5.1.008" expanded="true" height="60" name="Store" width="90" x="313" y="300">
            <parameter key="repository_entry" value="temp_store"/>
          </operator>
          <operator activated="false" class="retrieve" compatibility="5.1.008" expanded="true" height="60" name="General Error" width="90" x="313" y="165">
            <parameter key="repository_entry" value="Xmp_store"/>
          </operator>
          <operator activated="true" class="retrieve" compatibility="5.1.008" expanded="true" height="60" name="Checked Error" width="90" x="313" y="75">
            <parameter key="repository_entry" value="temp_storeY"/>
          </operator>
          <connect from_port="in 1" to_op="Store" to_port="input"/>
          <connect from_op="Checked Error" from_port="output" to_port="out 1"/>
          <portSpacing port="source_in 1" spacing="0"/>
          <portSpacing port="source_in 2" spacing="0"/>
          <portSpacing port="sink_out 1" spacing="0"/>
          <portSpacing port="sink_out 2" spacing="0"/>
        </process>
      </operator>
      <operator activated="true" class="generate_macro" compatibility="5.1.008" expanded="true" height="76" name="Generate Macro" width="90" x="313" y="210">
        <list key="function_descriptions">
          <parameter key="err" value="index(&quot;%{error_name}&quot;,&quot;temp_store&quot;)"/>
        </list>
        <parameter key="use_standard_constants" value="false"/>
      </operator>
      <operator activated="true" class="branch" compatibility="5.1.008" expanded="true" height="76" name="Branch" width="90" x="447" y="75">
        <parameter key="condition_type" value="expression"/>
        <parameter key="condition_value" value="%{err}&gt;-1"/>
        <process expanded="true" height="404" width="340">
          <operator activated="true" class="print_to_console" compatibility="5.1.008" expanded="true" height="60" name="Print to Console (2)" width="90" x="112" y="120">
            <parameter key="log_value" value="&quot;--&gt;OK&lt;---&quot;"/>
          </operator>
          <portSpacing port="source_condition" spacing="0"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_input 1" spacing="0"/>
          <portSpacing port="sink_input 2" spacing="0"/>
        </process>
        <process expanded="true" height="404" width="340">
          <operator activated="true" class="print_to_console" compatibility="5.1.008" expanded="true" height="60" name="Print to Console (5)" width="90" x="112" y="120">
            <parameter key="log_value" value="&quot;--&gt;%{error_name}&lt;--&quot;"/>
          </operator>
          <portSpacing port="source_condition" spacing="0"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_input 1" spacing="0"/>
          <portSpacing port="sink_input 2" spacing="0"/>
        </process>
      </operator>
      <connect from_op="Retrieve" from_port="output" to_op="Handle Exception" to_port="in 1"/>
      <connect from_op="Handle Exception" from_port="out 1" to_op="Generate Macro" to_port="through 1"/>
      <connect from_op="Generate Macro" from_port="through 1" to_op="Branch" to_port="condition"/>
      <connect from_op="Branch" from_port="input 1" to_port="result 1"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
    </process>
  </operator>
</process>
Tagged: