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

Confusing error message "Unhandled promise rejection" #7

Closed
aakoch opened this issue Dec 22, 2017 · 1 comment
Closed

Confusing error message "Unhandled promise rejection" #7

aakoch opened this issue Dec 22, 2017 · 1 comment
Milestone

Comments

@aakoch
Copy link
Contributor

aakoch commented Dec 22, 2017

I'm not sure you can do anything about this, but if I have some incorrect Pug syntax, I get an error like this:

File changed: index.pug
(node:17395) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Pug:4:17
    2| html(lang="en")
    3|   head
  > 4|     title= Some Title
-----------------------^
    5|   body
    6|     h1= title
    7|     p Source available at

Syntax Error: Unexpected token
(node:17395) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Now, the "Error: Pug:4:17" and "Syntax Error: Unexpected token" is correct. The "confusing" part is the "UnhandledPromiseRejectionWarning" and the "DeprecationWarning".

This is the error I get if I use the pug command:

> pug . --output _site

~/.npm-packages/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:59
    throw err;
    ^

Error: ./index.pug:7:17
    5| html(lang="en")
    6|   head
  > 7|     title= Some Title
-----------------------^
    8|   body
    9|     h1= title
    10|     p Source available at

Syntax Error: Unexpected token
    at makeError (~/.npm-packages/lib/node_modules/pug-cli/node_modules/pug-error/index.js:32:13)
    at Lexer.error (~/.npm-packages/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:58:15)
    at Lexer.assertExpression (~/.npm-packages/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:86:12)
    at Lexer.code (~/.npm-packages/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:971:28)
    at Lexer.callLexerFunction (~/.npm-packages/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:1319:23)
    at Lexer.advance (~/.npm-packages/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:1352:15)
    at Lexer.callLexerFunction (~/.npm-packages/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:1319:23)
    at Lexer.getTokens (~/.npm-packages/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:1375:12)
    at lex (~/.npm-packages/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:12:42)
    at Object.lex (~/.npm-packages/lib/node_modules/pug-cli/node_modules/pug/lib/index.js:99:27)
@zachleat zachleat added this to the v0.1.4 milestone Dec 26, 2017
@zachleat
Copy link
Member

Put some work into improving this for v0.1.4 (releasing soon).

image

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

No branches or pull requests

2 participants