Skip to content

Commit

Permalink
Fix hang on malformed firebase.json
Browse files Browse the repository at this point in the history
  • Loading branch information
mbleigh committed Oct 19, 2015
1 parent f78db4a commit dce33e3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Empty file removed lib/acquireConfig.js
Empty file.
4 changes: 2 additions & 2 deletions lib/command.js
Expand Up @@ -69,14 +69,14 @@ Command.prototype.register = function(client) {
}
var duration = new Date().getTime() - start;
track(self._name, 'success', duration).then(process.exit);
}, function(err) {
}).catch(function(err) {
if (utils.getInheritedOption(options, 'json')) {
console.log(JSON.stringify({
status: 'error',
error: err.message
}, null, 2));
}
var duration = new Date().getTime() - start;
var duration = Date.now() - start;
var errorEvent = err.exit === 1 ? 'Error (User)' : 'Error (Unexpected)';
var firebase = getFirebaseName(options, true);
var preppedMessage = chalk.stripColor(err.message || '').replace(firebase, '<namespace>');
Expand Down
11 changes: 8 additions & 3 deletions lib/getFirebaseName.js
Expand Up @@ -2,6 +2,7 @@

var Config = require('./config');
var FirebaseError = require('./error');
var logger = require('./logger');

/**
* Tries to determine the correct app name for commands that
Expand All @@ -16,9 +17,13 @@ module.exports = function(options, allowNull) {
if (options.firebase) {
return options.firebase;
}
var config = Config.load(options, true);
if (config && config.defaults.project) {
return config.defaults.project;
try {
var config = Config.load(options, true);
if (config && config.defaults.project) {
return config.defaults.project;
}
} catch (e) {
logger.debug('Config.load Error: ' + e.stack);
}

if (!allowNull) {
Expand Down

0 comments on commit dce33e3

Please sign in to comment.