I have had a couple times run into an issue where ...
# python
s
I have had a couple times run into an issue where my call to
<stackname>.get_output('foo')
silently fails and I only find out when some resource mysteriously isn’t configured correctly. The root of the error is me doing something silly like misspelling the variable name and I usually find it in not too long, but it would certainly make it easier to catch if the failure wasn’t silent. What is the rationale for not throwing an error during preview to prevent these issues?
f
It's not so much silently failing as it is working as intended...
get_output
naturally returns
None
if the given key doesn't exist. If you use
require_output
, it will throw an error if the key isn't present.
Same as
my_dict.get("foo")
vs.
my_dict.require("foo")
For stack references, I don't think I ever use
get_output
, for this exact reason.
s
Ah - ok. That makes sense. Thanks @full-artist-27215 for guiding me in the right direction!
👍 1