This message was deleted.
# golang
s
This message was deleted.
a
If your plan is to fail the program if
err
is non-nil, then you are already using
ApplyT
correctly:
Copy code
policyDocument := saml.Arn.ApplyT(yourFunction)
If you want to handle the error and keep going, you will need to do so inside the `ApplyT`:
Copy code
policyDocument := saml.Arn.ApplyT(func(arn string) (*iam.GetPolicyDocumentResult, error) {
  doc, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    Statements: []iam.GetPolicyDocumentStatement{
      {
        Principals: []iam.GetPolicyDocumentStatementPrincipal{
          {
            Type:        "Federated",
            Identifiers: []string{arn},
          },
        },
      },
    },
    if err != nil {
      return defaultDocument(arn)
     }
     return doc
  })
})
The first option is more common in Pulumi programs, but both are available.