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

No interpolation of template string when thrown #13402

Closed
Ryuno-Ki opened this issue Jun 2, 2017 · 7 comments
Closed

No interpolation of template string when thrown #13402

Ryuno-Ki opened this issue Jun 2, 2017 · 7 comments
Labels
invalid Issues and PRs that are invalid. v8 engine Issues and PRs related to the V8 dependency.

Comments

@Ryuno-Ki
Copy link

Ryuno-Ki commented Jun 2, 2017

Steps to reproduce

let foo = 'bar';
throw `${foo}baz`;

Expected result

Exception thrown with message barbaz.

Actual result

Exception thrown with message ${foo}baz.

This does not happen on Firefox.

@Fishrock123
Copy link
Contributor

Hmm, strange, it works for me in the repl:

> let foo = 'bar';
undefined
> throw `${foo}baz`;
barbaz

@mscdex mscdex added v8.x v8 engine Issues and PRs related to the V8 dependency. labels Jun 2, 2017
@cjihrig
Copy link
Contributor

cjihrig commented Jun 2, 2017

I can't reproduce on macOS with 8.0.0 or master.

$ node test.js 

/Users/cjihrig/iojs/node/test.js:2
throw `${foo}baz`;
^
barbaz

@vsemozhetbyt
Copy link
Contributor

@Ryuno-Ki Can you provide the full literal output with the thrown error?

@jasnell
Copy link
Member

jasnell commented Jun 2, 2017

Also unable to reproduce.

@bnoordhuis
Copy link
Member

@Ryuno-Ki Are you using source code processors / transpilers like babel?

@Ryuno-Ki
Copy link
Author

Ryuno-Ki commented Jun 6, 2017

Ah, maybe it is not a bug, but a feature …

$ cat test.js
let foo = "bar"
throw `${foo}baz`
$ node test.js 
$HOME/Projects/$REPO/test.js:2
throw `${foo}baz`
^
barbaz

But after adding an npm script for it and running that, I get

$ npm run throwaway
> $REPO@$VERSION throwaway $HOME/Projects/$REPO
> node ./test.js


$HOME/Projects/$REPO/test.js:2
throw `${foo}baz`
^
barbaz
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! $REPO@$VERSION throwaway: `node ./test.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the $REPO@$VERSION throwaway script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     $HOME/.npm/_logs/2017-06-06T09_39_00_354Z-debug.log

So it could be, that it outputted me a raw view of the file's content … In that case, sorry for the noise :)

@bnoordhuis bnoordhuis added the invalid Issues and PRs that are invalid. label Jun 6, 2017
@refack
Copy link
Contributor

refack commented Jun 6, 2017

@Ryuno-Ki thank you for the clarification and follow up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Issues and PRs that are invalid. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

8 participants