Skip to content
This repository has been archived by the owner on Jun 21, 2019. It is now read-only.

Commit

Permalink
added error handling back | bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
anolilab committed Sep 23, 2015
1 parent 66e5ab6 commit 8616a2c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
22 changes: 14 additions & 8 deletions dist/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ var _getIterator = require('babel-runtime/core-js/get-iterator')['default'];

var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];

var _interopRequireWildcard = require('babel-runtime/helpers/interop-require-wildcard')['default'];

exports.__esModule = true;
exports['default'] = cli;

Expand All @@ -17,7 +19,9 @@ var _markdowndoc = require('./markdowndoc');

var _markdowndoc2 = _interopRequireDefault(_markdowndoc);

// import * as errors from './errors';
var _errors = require('./errors');

var errors = _interopRequireWildcard(_errors);

var _docopt = require('docopt');

Expand Down Expand Up @@ -103,13 +107,15 @@ function cli() {

var env = new _environment2['default'](newConfig, getModus(options));

// env.on('error', error => {
// if (error instanceof errors.Warning) {
// process.exit(2);
// }
if (!options['--debug']) {
env.on('error', function (error) {
if (error instanceof errors.Warning) {
process.exit(2);
}

// process.exit(1);
// });
process.exit(1);
});
}

parseConfig(env, options);

Expand All @@ -118,7 +124,7 @@ function cli() {
require('./notifier')(_packageJson2['default'], env.logger);
}

return _markdowndoc2['default'](env);
_markdowndoc2['default'](env);
}

module.exports = exports['default'];
18 changes: 10 additions & 8 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Options:

import Environment from './environment';
import markdowndoc from './markdowndoc';
// import * as errors from './errors';
import * as errors from './errors';

import { docopt } from 'docopt';
import pkg from '../package.json';
Expand Down Expand Up @@ -88,13 +88,15 @@ export default function cli(argv = process.argv.slice(2)) {

const env = new Environment(newConfig, getModus(options));

// env.on('error', error => {
// if (error instanceof errors.Warning) {
// process.exit(2);
// }
if (!options['--debug']) {
env.on('error', error => {
if (error instanceof errors.Warning) {
process.exit(2);
}

// process.exit(1);
// });
process.exit(1);
});
}

parseConfig(env, options);

Expand All @@ -103,5 +105,5 @@ export default function cli(argv = process.argv.slice(2)) {
require('./notifier')(pkg, env.logger);
}

return markdowndoc(env);
markdowndoc(env);
}
6 changes: 3 additions & 3 deletions tests/src/environment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('#environment', function () {
it('should load look for .markdowndocrc or load default config if no path is set', function () {
var expected = {
'name' : 'markdowndoc',
'version' : '0.0.2',
'version' : '0.0.4',
'description': 'A documentation tool for Markdown.',
'debug' : false,
'style' : 'single',
Expand Down Expand Up @@ -46,7 +46,7 @@ describe('#environment', function () {
it('should render the default config', function () {
var expected = {
'name' : 'markdowndoc',
'version' : '0.0.2',
'version' : '0.0.4',
'description': 'A documentation tool for Markdown.',
'debug' : false,
'style' : 'multisite',
Expand Down Expand Up @@ -85,7 +85,7 @@ describe('#environment', function () {
it('should render the package config', function () {
var expected = {
'name' : 'markdowndoc',
'version' : '0.0.2',
'version' : '0.0.4',
'description': 'A documentation tool for Markdown.',
'debug' : false,
'style' : 'single',
Expand Down

0 comments on commit 8616a2c

Please sign in to comment.