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

Alfy eats errors from Run Script action #86

Open
ErikMinekus opened this issue Mar 30, 2018 · 4 comments
Open

Alfy eats errors from Run Script action #86

ErikMinekus opened this issue Mar 30, 2018 · 4 comments
Labels
💵 Funded on Issuehunt This issue has been funded on Issuehunt enhancement help wanted

Comments

@ErikMinekus
Copy link

ErikMinekus commented Mar 30, 2018

Issuehunt badges

Alfred's workflow debugger only shows output from stderr. These lines redirect all output from stderr to alfy.error(), which then uses console.log() to print it to stdout:

loudRejection(alfy.error);
process.on('uncaughtException', alfy.error);
hookStd.stderr(alfy.error);

This means that any errors that occur inside a Run Script action are never displayed in the workflow debugger.


IssueHunt Summary

Backers (Total: $20.00)

Submitted pull Requests


Become a backer now!

Or submit a pull request to get the deposits!

Tips


IssueHunt has been backed by the following sponsors. Become a sponsor

@sindresorhus
Copy link
Owner

Yes, we show the error in the Alfy itself instead:

alfy/index.js

Lines 70 to 96 in 0dafe8f

alfy.error = error => {
const stack = cleanStack(error.stack || error);
const copy = `
\`\`\`
${stack}
\`\`\`
-
${alfy.meta.name} ${alfy.meta.version}
Alfred ${alfy.alfred.version}
${process.platform} ${os.release()}
`.trim();
alfy.output([{
title: error.stack ? `${error.name}: ${error.message}` : error,
subtitle: 'Press ⌘L to see the full error and ⌘C to copy it.',
valid: false,
text: {
copy,
largetype: stack
},
icon: {
path: exports.icon.error
}
}]);
};

But you're right, we should also enable stderr to go through so it's also shown in the debugger.

@IssueHuntBot
Copy link

@IssueHunt has funded $20.00 to this issue.


@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label May 10, 2019
@LitoMore
Copy link
Sponsor Collaborator

LitoMore commented Sep 3, 2019

I think we don't need hook-std here. Remove the hook-std and add console.error to alfy.error will fix this issue.

@sindresorhus
Copy link
Owner

If anyone wants to work on this, see the initial attempt and feedback in #112.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💵 Funded on Issuehunt This issue has been funded on Issuehunt enhancement help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants