When there is a major issues with Docker (f.e. out of disk memory), dashmate wrongfully parses this response, and failing with SyntaxError: Unexpected token < in JSON at position 0 error.
[STARTED] Force nodes to sync
[DATA] 0.00% complete
SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at IncomingMessage.<anonymous> (/Users/ivanshumkov/Projects/dashevo/platform/.yarn/cache/@dashevo-dashd-rpc-npm-2.4.2-60538862a8-fbbb49ed2c.zip/node_modules/@dashevo/dashd-rpc/lib/index.js:128:26)
at IncomingMessage.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
<HTML><HEAD>
<TITLE>503 Service Unavailable</TITLE>
</HEAD><BODY>
<H1>Service Unavailable</H1>
</BODY></HTML>
HTTP Status code:503
node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^
OperationalError: Dash JSON-RPC: Error Parsing JSON: Unexpected token < in JSON at position 0
at IncomingMessage.<anonymous> (/Users/ivanshumkov/Projects/dashevo/platform/.yarn/cache/@dashevo-dashd-rpc-npm-2.4.2-60538862a8-fbbb49ed2c.zip/node_modules/@dashevo/dashd-rpc/lib/index.js:133:21)
... 2 lines matching cause stack trace ...
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
cause: Error: Dash JSON-RPC: Error Parsing JSON: Unexpected token < in JSON at position 0
at IncomingMessage.<anonymous> (/Users/ivanshumkov/Projects/dashevo/platform/.yarn/cache/@dashevo-dashd-rpc-npm-2.4.2-60538862a8-fbbb49ed2c.zip/node_modules/@dashevo/dashd-rpc/lib/index.js:133:21)
at IncomingMessage.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21),
isOperational: true
}
Possible Solution
Catch such errors and provide readable message for the user about the issue
Steps to Reproduce (for bugs)
Make your docker run out of disk memory
dashmate start
Context
Your Environment
Version used:
Environment name and version (e.g. Chrome 39, node.js 5.4):
Operating System and version (desktop, server, or mobile):
Expected Behavior
Dashmate shows readable error message
Current Behavior
When there is a major issues with Docker (f.e. out of disk memory), dashmate wrongfully parses this response, and failing with SyntaxError: Unexpected token < in JSON at position 0 error.
Possible Solution
Catch such errors and provide readable message for the user about the issue
Steps to Reproduce (for bugs)
Context
Your Environment