Javascript step error handling if you are familiar with the incorrect features of kettle conversion, you may want to know how to use it in javascript steps. The steps and user interfaces that support the error mechanism are the same. Right-click the javascript step and select "define error handling" to enable and configure error handling. Javascript code can identify error lines and forward them to the configuration
Javascript step error handling if you are familiar with the incorrect features of kettle conversion, you may want to know how to use it in javascript steps. The steps and user interfaces that support the error mechanism are the same. Right-click the javascript step and select "define error handling" to enable and configure error handling. Javascript code can identify error lines and forward them to the configuration
Javascript Step Error Handling
If you are familiar with the incorrect features of kettle conversion, you may want to know how to use it in javascript steps. The steps and user interfaces that support the error mechanism are the same. Right-click the javascript step and select "define error handling" to enable and configure error handling. Javascript code can identify error lines and forward them to the configured error handling steps. The following parameters are required by using the putError () method of the _ step _ OBJECT:
1) RowMetaInterface Object Description row Structure
2) current error line
3) number of errors detected in this row
4) Error description string (error message)
5) name of the field that caused the error (string)
6) error code (string)
Normally, original, unmodified input rows are passed to the error handling step. Therefore, the first two parameters are usually specified as getInputRowMeta () andRow. Other parameters depend on how you describe the errors you encounter. The javascript step defines the error handling configuration. You can configure the fields to be output to the error handling step.
The conversion example first generates a random string. For the purpose of illustration, the javascript step determines that the letters 'A' and 'K' are missing from the preceding characters, and an error is returned when each letter is missing.
The javascript step contains the following code:
varshould_error_on_a= (value.indexOf("a") == -1)?1:0;varshould_error_on_k= (value.indexOf("k") == -1)?1:0;try{ if(should_error_on_a== 1 && should_error_on_k == 1){ throw{ message:"Value must contain 'a' and 'k'", nr_errors:2, field:"value", errcode:"ERR:003" } } elseif(should_error_on_a== 1){ throw{ message:"Value must contain 'a'", nr_errors:1, field:"value", errcode:"ERR:001" } } elseif(should_error_on_k== 1){ throw{ message:"Value must contain 'k'", nr_errors:1, field:"value", errcode:"ERR:002" } } //continue normally, passing the row on to the next step trans_Status= CONTINUE_TRANSFORMATION;}catch(e){ //pert the current row to the error step and do not pass anything to thenext step _step_.putError(getInputRowMeta(),row, e.nr_errors, e.message, e.field, e.errcode); trans_Status= SKIP_TRANSFORMATION;}