From 81a6c2f344ff0d9d41d85c8eb0ef0eedd2690676 Mon Sep 17 00:00:00 2001 From: Pablo Carranza Velez Date: Tue, 5 Sep 2017 20:17:43 -0700 Subject: [PATCH] Fix problem catching errors when killing a container that doesn't exist We've been using `.catch Promise.OperationalError, ...` to catch errors when stopping a container and detecting whether the error means that the container has already been stopped of removed. Apparently, after the recent dockerode upgrade these errors are not typed as OperationalError anymore, causing error messages like "No such container: null" when applying an update. This commit makes us catch all errors and check for their statusCode. Change-Type: patch Signed-off-by: Pablo Carranza Velez --- src/application.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/application.coffee b/src/application.coffee index 338f8732..1bb4d558 100644 --- a/src/application.coffee +++ b/src/application.coffee @@ -162,8 +162,7 @@ application.kill = kill = (app, { updateDB = true, removeContainer = true } = {} .then -> container.remove(v: true) if removeContainer return - # Bluebird throws OperationalError for errors resulting in the normal execution of a promisified function. - .catch Promise.OperationalError, (err) -> + .catch (err) -> # Get the statusCode from the original cause and make sure statusCode its definitely a string for comparison # reasons. statusCode = '' + err.statusCode