Comment 3 for bug 1471737

Revision history for this message
Nikolay Makhotkin (nmakhotkin) wrote :

Ok, I just reverified this.

1. std.javascript indeed raises ActionException if we throw it via script itself
2. ActionException leads to ERROR in action, then it leads to ERROR in with-items and fail the whole workflow execution.

See example:

Have the following workflow:

---
version: "2.0"

name: test_js

workflows:
  js_test:
    type: direct

    tasks:
      task1:
        with-items: num in <% list(range(1, 10)) %>
        action: std.javascript
        input:
          script: |
            if ($.num % 2 == 0) {
              throw 'JS exception'
            }
            else {
              return $.num
            }
          context: <% $ %>

And here is the result:

workflow-execution:

| ed0e3837-9db6-4ca4-a841-676d11cc1e1a | test_js.js_test | | ERROR | Failure caused by error i... | 2015-07-06 15:27:56 | 2015-07-06 15:27:57 |

task-execution:

| e7f37881-c6dc-49d9-b5a2-940dc2aa1dc6 | task1 | test_js.js_test | ed0e3837-9db6-4ca4-a841-676d11cc1e1a | ERROR |

action-execution-list:

+--------------------------------------+----------------+-----------------+-----------+---------+------------+-------------+
| ID | Name | Workflow name | Task name | State | State info | Is accepted |
+--------------------------------------+----------------+-----------------+-----------+---------+------------+-------------+
| 1a7bfcd1-7dc6-45e9-a502-a3436587349f | std.javascript | test_js.js_test | task1 | ERROR | None | False |
| 7ef22829-31a5-4dd0-91db-99547e629485 | std.javascript | test_js.js_test | task1 | ERROR | None | False |
| 97058563-6123-400b-a45c-94dc24a6a80e | std.javascript | test_js.js_test | task1 | SUCCESS | None | True |
| ac43d554-b669-4c12-adf8-11179594d25a | std.javascript | test_js.js_test | task1 | SUCCESS | None | True |
| ba79725b-933f-41f2-ad9d-df8069dc9c9e | std.javascript | test_js.js_test | task1 | SUCCESS | None | True |
| d4f83301-0adf-4e22-86db-3b10763b4869 | std.javascript | test_js.js_test | task1 | SUCCESS | None | True |
| d8c9fb1e-3d94-400e-9012-6115b80a81dc | std.javascript | test_js.js_test | task1 | ERROR | None | False |
| e69a52a6-f93b-48c4-ab60-3a9e96340459 | std.javascript | test_js.js_test | task1 | SUCCESS | None | True |
| efbc680c-7fbf-47dd-a63b-8c89d672d430 | std.javascript | test_js.js_test | task1 | ERROR | None | False |
+--------------------------------------+----------------+-----------------+-----------+---------+------------+-------------+