Display msg when app/device does not have env variables. Fix #166

This commit is contained in:
mike 2015-08-18 17:03:39 +03:00
parent 433916e18a
commit 019e2ac357
2 changed files with 5 additions and 0 deletions

View File

@ -37,6 +37,9 @@
} }
}).tap(function(environmentVariables) { }).tap(function(environmentVariables) {
var isSystemVariable; var isSystemVariable;
if (_.isEmpty(environmentVariables)) {
throw new Error('No environment variables found');
}
if (!options.verbose) { if (!options.verbose) {
isSystemVariable = resin.models.environmentVariables.isSystemVariable; isSystemVariable = resin.models.environmentVariables.isSystemVariable;
environmentVariables = _.reject(environmentVariables, isSystemVariable); environmentVariables = _.reject(environmentVariables, isSystemVariable);

View File

@ -44,6 +44,8 @@ exports.list =
throw new Error('You must specify an application or device') throw new Error('You must specify an application or device')
.tap (environmentVariables) -> .tap (environmentVariables) ->
if _.isEmpty(environmentVariables)
throw new Error('No environment variables found')
if not options.verbose if not options.verbose
isSystemVariable = resin.models.environmentVariables.isSystemVariable isSystemVariable = resin.models.environmentVariables.isSystemVariable
environmentVariables = _.reject(environmentVariables, isSystemVariable) environmentVariables = _.reject(environmentVariables, isSystemVariable)