智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/47/47582221e3584489ee4b3762b13...

43 lines
850 B

'use strict';
const concat = require('../utils').concat;
const formatTitle = require('../utils/colors').formatTitle;
function displayError(severity, error) {
const baseError = formatTitle(severity, severity);
return concat(
`${baseError} ${removeLoaders(error.file)}`,
'',
error.message,
(error.origin ? error.origin : undefined),
'',
error.infos
);
}
function removeLoaders(file) {
if (!file) {
return "";
}
const split = file.split('!');
const filePath = split[split.length - 1];
return `in ${filePath}`;
}
function isDefaultError(error) {
return !error.type;
}
/**
* Format errors without a type
*/
function format(errors, type) {
return errors
.filter(isDefaultError)
.reduce((accum, error) => (
accum.concat(displayError(type, error))
), []);
}
module.exports = format;