Merge pull request #118 from resin-io/exec-format-error

Catch exec format error and provide friendlier message
This commit is contained in:
Pablo Carranza Vélez 2016-09-06 17:28:27 -03:00 committed by GitHub
commit c4f33d55ea
2 changed files with 12 additions and 0 deletions

View File

@ -1,3 +1,5 @@
* Catch exec format error and provide friendlier error message [Aleksis]
# v2.1.0
* Pick up new variable from hostOS, pointing to the mount point of the hostOS's boot partition [Theodor]

View File

@ -248,6 +248,16 @@ application.start = start = (app) ->
# 304 means the container was already started, precisely what we want :)
if statusCode is '304'
return
if statusCode is '500' and err.json.trim().match(/exec format error$/)
# Provide a friendlier error message for "exec format error"
device.getDeviceType()
.then (deviceType) ->
throw new Error("Application architecture incompatible with #{deviceType}: exec format error")
else
# rethrow the same error
throw err
.catch (err) ->
# If starting the container failed, we remove it so that it doesn't litter
container.removeAsync(v: true)
.then ->