PrismarineJS / node-mojangson

A mojangson parser written in node.js
17 stars 9 forks source link

Parser error when connected to Spigot server #1

Closed Darker closed 9 years ago

Darker commented 9 years ago

This popped up adn crashed my bot:

C:\Users\Jakub\node_modules\node-mojangson\grammar.js:148
        throw new Error(str);
              ^
Error: Parse error on line 1:
...st:31,display:{Name:"/\ Swacker Broad he
-----------------------^
Expecting 'EOF', 'RIGHTC', 'DP', 'COMMA', 'RIGHTP', got 'STRINGWITHOUTQUOTE'
    at Object.parseError (C:\Users\Jakub\node_modules\node-mojangson\grammar.js:148:15)
    at Object.parse (C:\Users\Jakub\node_modules\node-mojangson\grammar.js:213:22)
    at Object.module.exports.parse (C:\Users\Jakub\node_modules\node-mojangson\index.js:3:52)
    at ChatMessage.parse (C:\Users\Jakub\node_modules\mineflayer\lib\chat_message.js:134:41)
    at new ChatMessage (C:\Users\Jakub\node_modules\mineflayer\lib\chat_message.js:17:8)
    at C:\Users\Jakub\node_modules\mineflayer\lib\chat_message.js:44:32
    at Array.forEach (native)
    at ChatMessage.parse (C:\Users\Jakub\node_modules\mineflayer\lib\chat_message.js:39:17)
    at new ChatMessage (C:\Users\Jakub\node_modules\mineflayer\lib\chat_message.js:17:8)
    at parseJsonMessage7 (C:\Users\Jakub\node_modules\mineflayer\lib\plugins\chat.js:74:25)

I suppose that either you're something missing or the server is sending invalid data. If the former is true it remains mystery why normal clients do not have any problems. The error was probably caused by a death message which contained weapon info.

I cannot reproduce this since it wasn't my server.

rom1504 commented 9 years ago

I guess that should display a more complete error message with the complete input, I'll change that. That error message is too little information to know whether it's invalid data or a problem in the parser.

On Sun, Jul 12, 2015, 14:24 Jakub Mareda notifications@github.com wrote:

This popped up adn crashed my bot:

C:\Users\Jakub\node_modules\node-mojangson\grammar.js:148 throw new Error(str); ^ Error: Parse error on line 1: ...st:31,display:{Name:"/\ Swacker Broad he -----------------------^ Expecting 'EOF', 'RIGHTC', 'DP', 'COMMA', 'RIGHTP', got 'STRINGWITHOUTQUOTE' at Object.parseError (C:\Users\Jakub\node_modules\node-mojangson\grammar.js:148:15) at Object.parse (C:\Users\Jakub\node_modules\node-mojangson\grammar.js:213:22) at Object.module.exports.parse (C:\Users\Jakub\node_modules\node-mojangson\index.js:3:52) at ChatMessage.parse (C:\Users\Jakub\node_modules\mineflayer\lib\chat_message.js:134:41) at new ChatMessage (C:\Users\Jakub\node_modules\mineflayer\lib\chat_message.js:17:8) at C:\Users\Jakub\node_modules\mineflayer\lib\chat_message.js:44:32 at Array.forEach (native) at ChatMessage.parse (C:\Users\Jakub\node_modules\mineflayer\lib\chat_message.js:39:17) at new ChatMessage (C:\Users\Jakub\node_modules\mineflayer\lib\chat_message.js:17:8) at parseJsonMessage7 (C:\Users\Jakub\node_modules\mineflayer\lib\plugins\chat.js:74:25)

I suppose that either you're something missing or the server is sending invalid data. If the former is true it remains mystery why normal clients do not have any problems. The error was probably caused by a death message which contained weapon info.

I cannot reproduce this since it wasn't my server.

— Reply to this email directly or view it on GitHub https://github.com/rom1504/node-mojangson/issues/1.

Darker commented 9 years ago

I know that. Take it just for first indication of possible bug. If it's real, some reports will possibly follow.

The only thing I know this is related to death message containing info about named item that's likely to be colored. But it doesn't happen normally for colored item death messages.

rom1504 commented 9 years ago

Fixed by 86f73fee6ddd19b417b25d1d60605cf7b1ee9db1 That commit displays more info when an error happen.