mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-22 06:57:49 +00:00
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 <pablo@resin.io>
This commit is contained in:
parent
64eb5f4f24
commit
81a6c2f344
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user