This message was deleted.
# general
s
This message was deleted.
f
Do you mean not panic when you do type assertion like
Copy code
intOutput := stringOutput.ApplyT(func(v string) int {
    return len(v)
}).(pulumi.IntOutput)
or something else?
c
kiiiinda.
Copy code
intOutput := stringOutput.ApplyT(func(v string) int {
    i, err := foo(v)
    if err != nil {
        // handle this err somehow
    }
    return len(i)
}).(pulumi.IntOutput)
something like that is what i’m looking for
how do i handle the err at the outer layer if the subsequent foo(v) call errs
b
you can just return an error from the internal func:
Copy code
intOutput := stringOutput.ApplyT(func(v string) (int, error) {
    i, err := foo(v)
    if err != nil {
        // handle this err somehow
    }
    return len(i)
}).(pulumi.IntOutput)
c
Ah, I think the problem is I was returning an error as the first and only arg. didn’t realize that part of the output interface was error
thanks @billowy-army-68599!