turbot / flowpipe

Flowpipe is a cloud scripting engine. Automation and workflow to connect your clouds to the people, systems and data that matters.
https://flowpipe.io
GNU Affero General Public License v3.0
361 stars 13 forks source link

Can I ignore an invalid operand error in an input step? #805

Closed e-gineer closed 6 months ago

e-gineer commented 6 months ago

I'm trying to make this step fail (because throw doesn't work yet). To do so I've added a param.prompt * 2 expression to cause a runtime failure.

pipeline "single_approval" {

  // ...

  step "input" "approve" {

    notifier = notifier[param.approver]

    type = "button"

    subject = param.subject

    prompt = param.prompt * 2

    # TODO: not supported as of v0.4.0
    # timeout = param.timeout == -1 ? null : param.timeout

    option "approve" {
      label = "Approve"
      style = "ok"
    }

    option "deny" {
      label = "Deny"
      style = "alert"
    }

    error {
      ignore = true
    }

  }

That causes a failure as expected ... but what surprises me is that the actual pipeline is failing? I feel like the error { ignore = true } is not being respected for the input step?

[single_approval] Starting pipeline
[single_approval] Arg approver = foo
[single_approval] Arg default_decision = false
[single_approval] Arg prompt = Should I square 2?
[single_approval] Arg subject = Should I square 2?
[single_approval] Arg timeout = 10
[single_approval] Internal Error: approve: Invalid operand: Unsuitable value for left operand: a number is required.
(/Users/nathan/src/flowpipe-mod-approval/mod.fp:142,14-26)
Unsuitable value type: Unsuitable value: value must be known
(/Users/nathan/src/flowpipe-mod-approval/mod.fp:142,14-26)

[single_approval] Failed 1ms
vhadianto commented 6 months ago

Technically this is an evaluation/parsing error. The prompt is an input to the step and Flowpipe failed trying to gather/calculate the input to the operation. The step itself hasn't had a chance to run.

We've had some discussion in the past and summarise our finding here: https://github.com/turbot/flowpipe/issues/419#issuecomment-1846209150

As expected?

e-gineer commented 6 months ago

Makes sense - thank you. Closing.