From f66552b044093f1c90d497d8271d3259b403d34f Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Mon, 20 Aug 2018 10:36:29 -0500 Subject: [PATCH] errorMessage helper moved to utils --- lib/pipeline/webpackProcess.js | 11 +---------- lib/utils/utils.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/pipeline/webpackProcess.js b/lib/pipeline/webpackProcess.js index 847c278f..c701a857 100644 --- a/lib/pipeline/webpackProcess.js +++ b/lib/pipeline/webpackProcess.js @@ -3,19 +3,10 @@ const fs = require('../core/fs'); const ProcessWrapper = require('../core/processes/processWrapper'); const webpack = require('webpack'); const writeFile = require('util').promisify(require('fs').writeFile); +const {errorMessage} = require('../utils/utils'); 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 { constructor(options) { super(options); diff --git a/lib/utils/utils.js b/lib/utils/utils.js index 1f95b4ed..764237e2 100644 --- a/lib/utils/utils.js +++ b/lib/utils/utils.js @@ -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 = { joinPath, dirname, @@ -499,5 +509,6 @@ module.exports = { groupBy, sample, last, - interceptLogs + interceptLogs, + errorMessage };