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

core.setFailed should accept Errors #386

Closed
jasonkarns opened this issue Mar 18, 2020 · 3 comments
Closed

core.setFailed should accept Errors #386

jasonkarns opened this issue Mar 18, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@jasonkarns
Copy link

Describe the enhancement
It's extremely common (nay, the purpose) of core.setFailed to report Errors that are caught during an action. And yet, its method signature does not accept Error instances.

It would be beneficial to accept Error instances instead of requiring users to convert to strings.

Code Snippet
This would be especially beneficial for promise chains:

somePromise()
  .then(doThing)
  .then(doOther)
  .then(whatever)
  .catch(core.setFailed)

Present behavior:

core.setFailed(Error("foo")) results in: TypeError: (s || "").replace is not a function

@jasonkarns jasonkarns added the enhancement New feature or request label Mar 18, 2020
@thboop thboop changed the title core.setFailed should except Errors core.setFailed should accept Errors Mar 27, 2020
@thboop
Copy link
Collaborator

thboop commented Mar 27, 2020

I agree.

@bnb
Copy link

bnb commented Mar 31, 2020

+1. Putting the burden on users to pass the proper type rather than handling coercion in the module is not good DX.

@thboop
Copy link
Collaborator

thboop commented Apr 13, 2020

Resolved in #405

@thboop thboop closed this as completed Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants