Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handler(...args) {
runtime.startCommand(
commandModule.command || 'unknown',
process.argv
);
if (args[0].verbose) {
runtime.logger.minLoggingLevel = Logger.Level.Debug;
}
if (args[0].outputFile && typeof args[0].outputFile === 'string') {
runtime.logger.enableFileLogging(args[0].outputFile, {
json: Boolean(args[0].json),
});
}
try {
const results = commandModule.handler(...args) as
| undefined
| Promise;
if (results && results.catch) {
results.catch(error => {
runtime.unhandledError(error);
runtime.complete(1);