mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-17 10:19:47 +00:00
Treat the bluebird OperationalError wrapper correctly.
This commit is contained in:
parent
0fae904f1c
commit
51bfb69354
@ -53,9 +53,10 @@ exports.kill = kill = (app) ->
|
|||||||
container.stopAsync()
|
container.stopAsync()
|
||||||
.then ->
|
.then ->
|
||||||
container.removeAsync()
|
container.removeAsync()
|
||||||
.catch (err) ->
|
# Bluebird throws OperationalError for errors resulting in the normal execution of a promisified function.
|
||||||
# Make sure statusCode is definitely a string, for comparison reasons.
|
.catch Promise.OperationalError, (err) ->
|
||||||
statusCode = '' + err.statusCode
|
# Get the statusCode from the original cause and make sure statusCode its definitely a string for comparison reasons.
|
||||||
|
statusCode = '' + err.cause.statusCode
|
||||||
# 304 means the container was already stopped - so we can just remove it
|
# 304 means the container was already stopped - so we can just remove it
|
||||||
if statusCode is '304'
|
if statusCode is '304'
|
||||||
return container.removeAsync()
|
return container.removeAsync()
|
||||||
|
Loading…
Reference in New Issue
Block a user