Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mediaEmitter.on('CONN_ERROR', code => {
log.error(`ERROR: Unable to connect to Media Player Classic on port ${config.port}. ` +
`Make sure MPC is running, Web Interface is enabled and the port set in 'config.js' file is correct.\n` + code);
// If MPC was previously connected (ie. MPC gets closed while script is running)
// the whole process is killed and restarted by Forever in order to clean MPC Rich Presence
// from user's profile, as destroyRPC() apparently can't do so.
if (active) {
log.warn('WARN: Killing process to clean Rich Presence from your profile...');
process.exit(0);
}
if (mpcServerLoop._onTimeout !== checkMPCEndpoint) {
clearInterval(mpcServerLoop);
mpcServerLoop = setInterval(checkMPCEndpoint, 15000);
}
});
async function buildSamples() {
const directories = getDirs(samplePath);
for await (const dir of directories) {
const dirName = dir.replace(__dirname, '');
log.info(`Building ${clc.magenta(dirName)}`);
try {
await exec(`npm run build --prefix ${dir}`);
log.info(`Finished building ${clc.magenta(dirName)}`);
} catch (err) {
log.error(`Failed building ${clc.magenta(dirName)}:`);
if (err.stdout) {
log.error(err.stdout);
}
process.exit(1);
}
}
}
.catch(function(error){
log.error("Could not start OCSP server: " + error);
});
async onMessage(message) {
try {
const ts = parseFloat(message.ts) * 1000
if (this.startedAt > ts) return
if (typeof message.subtype === 'string') return
const channel = this.slackChannelResolver.resolve(message.channel)
await Promise.all([
this.processConfluence({ message, channel }),
this.processJira({ message, channel }),
])
} catch (e) {
log.error(e)
}
}
.catch(function(err){
log.error("Could not re-index CertDB.");
});
});
webpack(webpackProdConfig, function(error, stats) {
if (error || stats.hasErrors()) {
log.error('Webpack build error:', error);
}
log.info(stats.toString(webpackProdConfig.stats));
log.info('Webpack build done');
done();
});
});
gulp.task('fixShrinkwrap', function fixShrinkwrap (done) {
let shrinkwrap;
try {
shrinkwrap = require('./npm-shrinkwrap.json');
} catch (err) {
log.error('Could not find shrinkwrap; skipping fixing shrinkwrap. ' +
`(Original error: ${err.message})`);
return done();
}
delete shrinkwrap.dependencies.fsevents;
const shrinkwrapString = JSON.stringify(shrinkwrap, null, ' ') + '\n';
fs.writeFile('./npm-shrinkwrap.json', shrinkwrapString, done);
});
async onAuthenticated(message) {
log(`${this.domain} -> authenticated`)
try {
const teamInfo = await this.web.team.info()
delete teamInfo['team']['icon']
log(`${this.domain} -> ${JSON.stringify(teamInfo.team)}`)
} catch (e) {
log.error(e)
}
}
function log(mode, ...messages) {
switch (mode) {
case 'verbose':
if (isTravisBuild()) {
return;
}
fancyLog.info(colors.green('VERBOSE:'), ...messages);
break;
case 'info':
fancyLog.info(colors.green('INFO:'), ...messages);
break;
case 'warning':
fancyLog.warn(colors.yellow('WARNING:'), ...messages);
break;
case 'error':
fancyLog.error(colors.red('ERROR:'), ...messages);
break;
case 'fatal':
process.exitCode = 1;
fancyLog.error(colors.red('FATAL:'), ...messages);
throw new Error(messages.join(' '));
case 'travis':
if (isTravisBuild()) {
messages.forEach(message => process.stdout.write(message));
}
break;
}
}
NPM.publish(function (pubError) {
if (pubError) {
log.error('Publish failed, your changelog may get in an undefined state :(')
log.error(pubError)
throw pubError
}
})
})