apocas/docker-modem

docker-modem silently returns different output

freefood89 opened this issue · 0 comments

Is there a specific reason behind silently supressing an error and returning a string instead of a parsed object as shown below?

https://github.com/apocas/docker-modem/blob/master/lib/modem.js#L199-L203

Modem.prototype.buildRequest = function(options, context, data, callback) {
    ....
    req.on('response', function(res) {
    ...
        try {
          json = JSON.parse(chunks);
        } catch (e) {
          json = chunks;
        }
    ...
})

I had a bunch of stopped containers and docker.listContainers({all: true}, ... ) broke silently.

If there's no reason, then I would like to submit a patch.