Backend should return a SCJSONSyntaxError when a bad JSON document was sent

Summary

At the time the backend replies with a SyntaxError which is generated by JSON.parse if an invalid JSON document is sent. This should be an Error which is an instance of the SCError in StAppsCore.

Which version of the software did you use ?

02475f59

Relevant logs and/or screenshots

SyntaxError: Unexpected token } in JSON at position 3
    at JSON.parse (<anonymous>)
    at parse (/app/node_modules/body-parser/lib/types/json.js:89:19)
    at /app/node_modules/body-parser/lib/read.js:121:18
    at invokeCallback (/app/node_modules/raw-body/index.js:224:16)
    at done (/app/node_modules/raw-body/index.js:213:7)
    at IncomingMessage.onEnd (/app/node_modules/raw-body/index.js:273:7)
    at IncomingMessage.emit (events.js:182:13)
    at endReadableNT (_stream_readable.js:1094:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Possible fixes

Create a middleware that wraps JSON.parse and throws an SCError with the message from JSON.parse instead.

cc: @krlwlfrt