https://pulumi.com logo
#python
Title
s

sparse-state-34229

10/29/2021, 1:54 AM
is it possible to handle the
KeyError
on an invalid
require_output
? if I do this:
Copy code
try:
    foo = stack_output.require_output("doesnt_exist")
except KeyError:
    # whatever
the key error seems to be unhandled:
Copy code
value = Output.all(Output.from_input(name), self.outputs).apply(lambda l: l[1][l[0]]) # type: ignore
    KeyError: 'doesnt_exist'
    error: an unhandled error occurred: Program exited with non-zero exit code: 1
r

red-match-15116

10/29/2021, 2:08 AM
Do you mean to use get_output instead since it's not guaranteed?
s

sparse-state-34229

10/29/2021, 2:09 AM
I actually just found that one, thanks 🙂
it looks to work better for this use case yeah