Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance CLI messaging #10560

Open
Tracked by #10553
toriancrane opened this issue Jan 11, 2024 · 0 comments
Open
Tracked by #10553

Enhance CLI messaging #10560

toriancrane opened this issue Jan 11, 2024 · 0 comments
Labels
area/docs Improvements or additions to documentation kind/enhancement Improvements or new features size/M Estimated effort to complete (up to 5 days).

Comments

@toriancrane
Copy link
Contributor

toriancrane commented Jan 11, 2024

The current error message looks like the following:

Calling __str__ on an Output[T] is not supported. To get the value of an Output[T] as an Output[str] consider: 1. o.apply(lambda v: f"prefix{v}suffix") See https://pulumi.io/help/outputs for more details.

The lambda v: f"prefix{v}suffix part of this message is especially confusing because this error comes up in scenarios that do not involve any string concatenation or anything involving a prefix or suffix. Some recommendations for enhancements include:

  • Removing that example and just redirecting users to the docs to see multiple examples of how to get their desired value (this is also assuming that the docs have been updated to provide more clarity in this regard)
  • Providing a longer but still concise list of some of the more common use cases. Ex:
Calling __str__ on an Output[T] is not supported.
To get the value of an Output[T] as an Output[str]

consider:
    1. <Output[T]>.apply(lambda v: v)
    2. <Output[T]>.apply(lambda v: f"randomstring{v}restofstring")
    3. <Output[T]>.apply(lambda v: f"prefix-{v}-suffix")
    4. myVariable = <Output[T]>.apply(lambda v: f"{v}")
    5. myVariable = some.key.apply(lambda value: f"{value}")

See[ https://www.pulumi.com/docs/concepts/inputs-outputs](https://www.pulumi.com/docs/concepts/inputs-outputs) for more details on working with Outputs in Pulumi.
@github-actions github-actions bot added the needs-triage Needs attention from the triage team label Jan 11, 2024
@github-project-automation github-project-automation bot moved this to 🤔 Triage in Docs 📚 Jan 11, 2024
@toriancrane toriancrane moved this from 🤔 Triage to 🎬 Ready in Docs 📚 Jan 11, 2024
@toriancrane toriancrane added area/docs Improvements or additions to documentation size/S Estimated effort to complete (1-2 days). kind/enhancement Improvements or new features size/M Estimated effort to complete (up to 5 days). and removed needs-triage Needs attention from the triage team size/S Estimated effort to complete (1-2 days). labels Jan 11, 2024
@cnunciato cnunciato moved this from 🎬 Ready to 🧳 Backlog in Docs 📚 Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs Improvements or additions to documentation kind/enhancement Improvements or new features size/M Estimated effort to complete (up to 5 days).
Projects
Status: 🧳 Backlog
Development

No branches or pull requests

1 participant