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.

Suppress error message at shutdown

See original GitHub issue

Every time I close my node.js server with rclnodejs running I get this error message:

.../my-project/node_modules/rclnodejs/index.js:300
      throw new Error('The module rclnodejs has been shutdown.');
      ^

Error: The module rclnodejs has been shutdown.
    at Object.shutdown (.../my-project/node_modules/rclnodejs/index.js:300:13)
    at process.<anonymous> (.../my-project/node_modules/rclnodejs/index.js:412:7)
    at process.emit (events.js:314:20)

It originates from here: https://github.com/RobotWebTools/rclnodejs/blob/178c2c7068e9c1961f0db3328ab74a366803340e/index.js#L410-L414

I don’t quite get why it is raised in the first place, but anyhow, wouldn’t it be better if there was a rclnodejs.tryShutdown() method that would be called in that event instead? It would be much like the existing Context.tryShutdown(): Don’t do anything if the (default) context is already shut down and else shut it down now.

Is such a change welcome? If yes, I can offer to implement it.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
minggangwcommented, Nov 10, 2020

The reason why you got the error is that you terminated the process before the Promise return by rclnodejs.regenerateAll() is resolved, so the rclnodejs module hasn’t been started practically. Normally, generating all the messages triggered by regenerateAll() method takes more around 20s, so you could wait for a while and then press ctrl+c to check if the error is still reported.

It would be much like the existing Context.tryShutdown(): Don’t do anything if the (default) context is already shut down and else shut it down now. Is such a change welcome? If yes, I can offer to implement it.

+1, I think it’s more user friendly, please go-ahead to submit the PR, thanks!

0reactions
minggangwcommented, Nov 12, 2020
const rclnodejs = require('rclnodejs');
rclnodejs.regenerateAll().then(() => {
    rclnodejs.init().then(() => {
        // Please print a log here to ensure the promise has been resolved.
        // I cannot reproduce it on my local linux with develop branch.
        const node = rclnodejs.createNode('some_node_name_wow');
        rclnodejs.spin(node);
    })
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Message When Shutting Down
Select System Configuration then click Services tab. Put a check on the box that say Hide all Microsoft services. Click Apply then OK....
Read more >
Disable the Shutdown & Logoff Status Messages On Your ...
Go to the Location Administrative Templates> System> Remove Boot/ Shutdown/ Logon/ Logoff status messages and select disable to enable shutdown and logoff ...
Read more >
How to Disable Error Reporting in Windows
Disable Error Reporting in Windows XP · Go to Start and then Control Panel. · Select Performance and Maintenance. · Select System under...
Read more >
How to disable has stopped working message in windows
Disable the Error Dialog Through Registry Editor · 1. Type regedit into a new run command (windows key + r) and select OK...
Read more >
Ubuntu 20.04 - How to hide error messages at shutdown
My Ubuntu 20.04 displays some error messages at shutdown almost every time. I want to hide error messages even if there are errors....
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