better handling of missing config; closes #22

This commit is contained in:
Radek Stepan 2013-10-01 11:12:48 +01:00
parent fc08c91fac
commit b9ecb4db41
2 changed files with 4 additions and 2 deletions

View File

@ -28116,7 +28116,9 @@ module.exports = function(cb) {
wait = true;
return request.config(function(err, result) {
var field, k, v, validator;
config = (err ? {} : result);
if (err || !_.isObject(result)) {
config = {};
}
for (k in defaults) {
v = defaults[k];
if (config[k] == null) {

View File

@ -44,7 +44,7 @@ module.exports = (cb) ->
# Make the request.
request.config (err, result) ->
# We do not strictly require config files.
config = ( if err then { } else result )
config = {} if err or not _.isObject result
# Tack on defaults?
( config[k] ?= v for k, v of defaults )