https://pulumi.com logo
#golang
Title
# golang
c

clever-byte-21551

09/24/2020, 5:15 AM
Why the
ApplyX
methods doesn’t return an error? What if I need to to some manipulation that can result in an error (e.g marshal a json)
l

lemon-agent-27707

09/24/2020, 4:43 PM
How would you want this to work? Apply returns an output (like a promise), so any error value returned would also have to be an output. The work doesn't happen immediately so I'm not sure it would be useful in a traditional go error handling context.
c

clever-byte-21551

09/24/2020, 5:20 PM
I understand that but I’d expect that the callback for the apply should also return an error to indicate the transformation has failed somehow - and fail the entire deployment
l

lemon-agent-27707

09/24/2020, 5:28 PM
Some forms of apply are explicit about allowing errors in the callback: https://github.com/pulumi/pulumi/blob/b4452061014da5bae9ed79c6243acd70c92e2972/sdk/go/pulumi/types.go#L303 I'm not certain, but I believe you can return an error in
ApplyX
methods.
c

clever-byte-21551

09/24/2020, 6:16 PM
I see, I’ll give it a try
The lack of generics in go is always effecting me 😄
l

lemon-agent-27707

09/24/2020, 6:41 PM
Yeah, it's unfortunate. It's on my eventual todo to try and play around with pulumi and the generics proposal.
3 Views