errorMessage helper moved to utils

This commit is contained in:
Michael Bradley, Jr 2018-08-20 10:36:29 -05:00
parent c8cd5f4229
commit f66552b044
2 changed files with 13 additions and 11 deletions

View File

@ -3,19 +3,10 @@ const fs = require('../core/fs');
const ProcessWrapper = require('../core/processes/processWrapper'); const ProcessWrapper = require('../core/processes/processWrapper');
const webpack = require('webpack'); const webpack = require('webpack');
const writeFile = require('util').promisify(require('fs').writeFile); const writeFile = require('util').promisify(require('fs').writeFile);
const {errorMessage} = require('../utils/utils');
let webpackProcess; let webpackProcess;
function errorMessage(e) {
if (typeof e === 'string') {
return e;
} else if (e && e.message) {
return e.message;
} else {
return e;
}
}
class WebpackProcess extends ProcessWrapper { class WebpackProcess extends ProcessWrapper {
constructor(options) { constructor(options) {
super(options); super(options);

View File

@ -458,6 +458,16 @@ function interceptLogs(consoleContext, logger) {
}; };
} }
function errorMessage(e) {
if (typeof e === 'string') {
return e;
} else if (e && e.message) {
return e.message;
} else {
return e;
}
}
module.exports = { module.exports = {
joinPath, joinPath,
dirname, dirname,
@ -499,5 +509,6 @@ module.exports = {
groupBy, groupBy,
sample, sample,
last, last,
interceptLogs interceptLogs,
errorMessage
}; };