mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-03 00:00:51 +00:00
Avoid trying to send a response to API calls after we've already sent an error
In some cases we were using early `return res.status(...).send(...)` to send 400 errors but this happened inside a promise chain that later sent another status and response. We fix this with the correct indentation of the success response so that an early return doesn't fall there. Change-Type: patch Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
parent
79b4d39acd
commit
f76aacc7fb
@ -136,7 +136,7 @@ createApplicationManagerRouter = (applications) ->
|
||||
.then (app) ->
|
||||
service = app?.services?[0]
|
||||
if !service?
|
||||
return res.status(400).send('App not found after running action')
|
||||
throw new Error('App not found after running action')
|
||||
return service
|
||||
.then (service) ->
|
||||
res.status(200).json({ containerId: service.containerId })
|
||||
|
Loading…
x
Reference in New Issue
Block a user