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

Make server don't crash from non fatal errors. #612

Open
nathan130200 opened this issue Oct 9, 2022 · 0 comments
Open

Make server don't crash from non fatal errors. #612

nathan130200 opened this issue Oct 9, 2022 · 0 comments

Comments

@nathan130200
Copy link

nathan130200 commented Oct 9, 2022

I was testing sample server code. And i just had tried use /attach command with an entity selector, and server crashed

\flying-squid\src\lib\plugins\commands.js:11
     else setTimeout(() => { throw err }, 0)
                              ^

TypeError: Cannot read properties of null (reading '1')
    at serv.selectorString (C:\Users\Nathan\Documents\Minecraft\Servers\basic-server-node\node_modules\flying-squid\src\lib\plugins\commands.js:282:14)
    at entity.selectorString (C:\Users\Nathan\Documents\Minecraft\Servers\basic-server-node\node_modules\flying-squid\src\lib\plugins\commands.js:17:41)
    at parse (C:\Users\Nathan\Documents\Minecraft\Servers\basic-server-node\node_modules\flying-squid\src\lib\plugins\spawn.js:184:48)       
    at Command.use (C:\Users\Nathan\Documents\Minecraft\Servers\basic-server-node\node_modules\flying-squid\src\lib\command.js:35:28)        
    at player.handleCommand (C:\Users\Nathan\Documents\Minecraft\Servers\basic-server-node\node_modules\flying-squid\src\lib\plugins\commands.js:7:39)
    at C:\Users\Nathan\Documents\Minecraft\Servers\basic-server-node\node_modules\flying-squid\src\lib\plugins\chat.js:125:89
    at Entity.behavior (C:\Users\Nathan\Documents\Minecraft\Servers\basic-server-node\node_modules\flying-squid\src\lib\behavior.js:24:14)   
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.10.0

Instead propagate entire error, why just forward to error and clientError events as described in docs

UPDATE: I had to set unhandled exception hook in nodejs to don't close server:

process.setUncaughtExceptionCaptureCallback(err => {
    console.log('UNHANDLED ERROR: ' + err);
});

Log

October 9th 2022, 17:25:33 [INFO]: FRNathan13 issued command: /attach
UNHANDLED ERROR: TypeError: Cannot read properties of null (reading '1')```
@nathan130200 nathan130200 changed the title Make server don't from non fatal errors. Make server don't crash from non fatal errors. Oct 9, 2022
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

1 participant