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

Pretty print ENOENT errors on cli #1396

Merged
merged 1 commit into from
Dec 20, 2018
Merged

Conversation

mccraveiro
Copy link
Contributor

@mccraveiro mccraveiro commented Dec 20, 2018

Marked version: master branch

Markdown flavor: n/a

Description

Hide the JS stack trace on CLI errors

Contributor

  • Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
  • no tests required for this PR.
  • If submitting new feature, it has been documented in the appropriate places.

Committer

In most cases, this should be a different person than the contributor.

  • Draft GitHub release notes have been updated.
  • CI is green (no forced merge required).
  • Merge PR

@UziTech
Copy link
Member

UziTech commented Dec 20, 2018

I'm not sure if this is the correct solution. It would be easier to debug with the stack trace.

If we want to fix #205 we should catch that error and show a relevant message.

@mccraveiro
Copy link
Contributor Author

@UziTech What message would you show on #205 situation?

I'm not sure that debugging is something one would do while using the cli.
Should we use NODE_ENV to show the stack when in development mode?

@UziTech
Copy link
Member

UziTech commented Dec 20, 2018

could be something like

marked: output to nonexistent_dir/test.html: No such directory

The way this PR is right now the output would be

Error: ENOENT, open 'nonexistent_dir/test.html'

which is not much more helpful.

@mccraveiro
Copy link
Contributor Author

@UziTech done :)

@mccraveiro mccraveiro changed the title Pretty print errors on cli Pretty print ENOENT errors on cli Dec 20, 2018
Copy link
Member

@styfle styfle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@styfle styfle merged commit 0fd0a97 into markedjs:master Dec 20, 2018
@mccraveiro mccraveiro deleted the cli-error branch December 20, 2018 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad CLI error output when outputting to nonexistent directory
3 participants