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

Support promise returning commands #108

Open
evaera opened this issue Mar 9, 2020 · 1 comment
Open

Support promise returning commands #108

evaera opened this issue Mar 9, 2020 · 1 comment
Labels

Comments

@evaera
Copy link
Owner

evaera commented Mar 9, 2020

No description provided.

@evaera evaera added type:enhancement New feature or request scope:internal labels Apr 27, 2020
@autonordev
Copy link
Collaborator

A complication with this is that the most common Promise implementation has nothing necessarily unique about it, so if a table is returned we have to decide between treating it as a problem or if it 'looks' like a promise, then treating it as one.

We could do this by seeing if it has both a resolve and reject functions. If so, we'll use these; I don't see much risk with this.

When a command returns a promise, resolve would be treated like usual command output but we need to decide between treating reject like:

  1. an internal Cmdr error (red text in the output with the message)
  2. regular output (white text in the output with the message)
  3. like any other command error (red text in the output and warning emitted)

Personally I lean towards 3 since it's not our job to handle errors for developers, but we can be kind and prevent obscure unhandledPromiseRejection warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants