mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-01 19:46:44 +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()
|
||||
.then ->
|
||||
container.removeAsync()
|
||||
.catch (err) ->
|
||||
# Make sure statusCode is definitely a string, for comparison reasons.
|
||||
statusCode = '' + err.statusCode
|
||||
# Bluebird throws OperationalError for errors resulting in the normal execution of a promisified function.
|
||||
.catch Promise.OperationalError, (err) ->
|
||||
# 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
|
||||
if statusCode is '304'
|
||||
return container.removeAsync()
|
||||
|
Loading…
Reference in New Issue
Block a user