Skip to content

Commit

Permalink
Merge pull request #36 from timaschew/patch-3
Browse files Browse the repository at this point in the history
Better error handling.
  • Loading branch information
tschaub committed Dec 8, 2015
2 parents 392de02 + 9a96590 commit 0794c0b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,27 @@ function getRepo(options) {
* Push a git branch to a remote (pushes gh-pages by default).
* @param {string} basePath The base path.
* @param {Object} config Publish options.
* @param {Function} done Callback.
* @param {Function} callback Callback.
*/
exports.publish = function publish(basePath, config, done) {
/*eslint-disable no-console */
exports.publish = function publish(basePath, config, callback) {
if (typeof config === 'function') {
done = config;
callback = config;
config = {};
}

var done = function(arguments) {
try {
(callback || function(err) {
if (err) {
console.log(err);
}
})(arguments);
} catch (err) {
console.error('errors during calling the callback: ', err);
}
}

var defaults = {
add: false,
git: 'git',
Expand Down

0 comments on commit 0794c0b

Please sign in to comment.