question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ending a script block with a comment line errors out

See original GitHub issue

Not a problem in real life scenarios but ending a script block with a comment terminates the script’s execution with a fatal error.

Example

### Health check
{{BASE_URL}}/checks/health

{{
  console.log('I will be outputted')
  // I have a feeling this will not end well
}}
prompt$ httpyac --env prod --all ./requests/system/health-check.http 
js:   console.log('I will be outputted')
  // I have a feeling this will not end well
                                                                  

SyntaxError: Unexpected end of input
    at new Script (vm.js:101:7)
    at createScript (vm.js:262:10)
    at Object.runInThisContext (vm.js:310:10)
    at /Users/me/.nvm/versions/node/v14.15.5/lib/node_modules/httpyac/dist/index.js:1:37428
    at Generator.next (<anonymous>)
    at /Users/me/.nvm/versions/node/v14.15.5/lib/node_modules/httpyac/dist/index.js:1:36507
    at new Promise (<anonymous>)
    at s (/Users/me/.nvm/versions/node/v14.15.5/lib/node_modules/httpyac/dist/index.js:1:36252)
    at g (/Users/me/.nvm/versions/node/v14.15.5/lib/node_modules/httpyac/dist/index.js:1:36786)
    at t.JavascriptAction.<anonymous> (/Users/me/.nvm/versions/node/v14.15.5/lib/node_modules/httpyac/dist/index.js:1:38658)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
AnWebercommented, Jul 19, 2021

Since I’m a fan of GitLens, I often leave out comments like this. image But you’re right, a comment would make sense here, since there are two little surprises in those two lines

1reaction
AnWebercommented, Jul 18, 2021

With the latest update (v2.20.0) the issue is fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Block comments in user script not working properly [19377]
Block comments are useful for both temporarily commenting out a contiguous series of lines as well as easily removing the block comment. However ......
Read more >
Stop or exit a PowerShell script when it errors - 4sysops
One way a scripter can invoke a terminating error is by using the throw keyword. This PowerShell construct creates a terminating error while ......
Read more >
Handle errors in ScriptBlock in Invoke-Command Cmdlet
When there is an error while executing New-Service the $errortext ErrorVariable get set properly inside the ScriptBlock, because the text: " ...
Read more >
Comments at the end of script lines | Automic Workload ...
I recently came across an object with comments at the end of script lines. E.g.,. :SET &VAR1# = "ABC123" ! This is a...
Read more >
Everything you wanted to know about exceptions - PowerShell
Basic terminology; Basic command syntax; $PSItem; Working with exceptions; Try can create terminating errors; Trap; Closing remarks.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found