Highlights some commonly known Lambda error cases in red:
            - Nodejs process crashes
            - Lambda function timeouts
494245
def colorize_errors(event, colored):
        

        nodejs_crash_msg = "Process exited before completing request"
        timeout_msg = "Task timed out"

        if nodejs_crash_msg in event.message \
                or timeout_msg in event.message:
            event.message = colored.red(event.message)

        return event
1014930
function handleMongoWriteConcernError(batch, bulkResult, ordered, err, callback) {
  mergeBatchResults(ordered, batch, bulkResult, null, err.result);

  const wrappedWriteConcernError = new WriteConcernError({
    errmsg: err.result.writeConcernError.errmsg,
    code: err.result.writeConcernError.result
  });
  return handleCallback(
    callback,
    new BulkWriteError(toError(wrappedWriteConcernError), new BulkWriteResult(bulkResult)),
    null
  );
}
124935
function invokeInstall(err, result) {
    // Log the input / command parse results.
    console.log('Command-line input received:');
    console.log('package: ' + result.package);
    console.log('version: ' + result.version);
    console.log('   type: ' + (isDevDependency ? 'dev' : 'production'));
    console.log('    mvn: ' + (shouldRunMaven ? 'will run mvn' : 'will not run mvn'));

    async.map(directories,
        function (elem, callback) {
            console.log('Current element', elem);
            removeAndInstall(elem, result.package,  result.version, callback);
        },
        function (err, result) {
            if (err) {
                console.error('Something went wrong! node_modules might now be trashed, sorry.', err);
                process.exit(1);
            } else {
                const elapsed = new Date().getTime() - start;
                console.log(`Install look good! took ${elapsed}ms`);
                process.exit(0);
            }
        }
    );
}
494097
function onOutError(err) {
    errNodecat = combineErrors(errNodecat, err);
    errStream.write(`nodecat: ${err}\n`);
    if (inCleanup) {
      inCleanup();
    }
    allDone();
  }
1281051
function(blob) {
    if (blob.csslint && blob.csslint.length && blob.csslint[0].line !== undefined) {
      console.log('\nCSSLint reports issues in: '.red + blob.name);
      blob.csslint.forEach(function(i){
        if (i) {
          console.log(' Line ' + i.line + ', Col ' + i.col + ': ' + i.message);
        }
      });
    }
  }
458214
function handleEnoentError(opts, err) {
  console.log(chalk.red(
    '\nError: ' + err.name + '. "' + err.path + '" does not exist.\n'
  ));
}
1344891
function errHandler(err, req, res, next) {
  console.log(addTimestamp("Internal error: " + util.inspect(err)));
  console.error(addTimestamp("Internal error: " + util.inspect(err)));
  if (err && err.stack) {
    console.error(err.stack);
  }

  var errorMessage = {
    msg: 'Internal error: ' + util.inspect(err),
    error: util.inspect(err)
  };
  if (res) {
    res.statusCode = 500;
    res.end(JSON.stringify(errorMessage));
  }

  return errorMessage;
}
797732
function errors() {
        // handling 404 errors from config.express['404_redirect'] property
        if (config['404_redirect']) {
            server.use(function (req, res, next) {
                res.status(302)
                res.writeHead(302, { 'Location': config['404_redirect'] })
                res.end()
            })
        } else {
            server.use(function (req, res, next) {
                res.status(404).send({ message: 'not found' })
            })
        }

        if (errorHandlers.length) {
            for (let eh of errorHandlers) {
                server.use(wrapper(eh))
            }
        }

        //Default error handler
        server.use((err, req, res, next) => {
            if (!config.silent && !errorHandlers.length)
                app.drivers.logger.error('Unhandled server error', err)
            res.status(500)
               .json({
                   message: err.message,
                   stack: process.env.NODE_ENV === 'production' ? undefined : err.stack
               })
        })
    }
694022
function colorErrors(stdLine) {
  // lazy load chalk
  if (chalk === undefined) {
    chalk = require("chalk");
  }

  return colorErrorPatterns.reduce((op, pattern) => {
    const matches = pattern.exec(op);

    if (matches !== null && matches.length > 0) {
      op = op.replace(pattern, chalk.red(matches[0]));
    }

    return op;
  }, stdLine);
}
647395
def lambda_handler(event, context):
    ''' 
    '''
    # event is a dict containing a base64 string gzipped
    event = json.loads(gzip.GzipFile(fileobj=StringIO(event['awslogs']['data'].decode('base64'))).read())

    account = event['owner']
    region = context.invoked_function_arn.split(':', 4)[3]

    log_events = event['logEvents']

    for log_event in log_events:
        message = json.loads(log_event['message'])
        ts = log_event['timestamp'] / 1000
        _process_rds_enhanced_monitoring_message(ts, message, account, region)

    stats.flush()
    return {'Status': 'OK'}
508414
function handleError (task) {
  return function (err) {
    console.log(chalk.red(err));
    notify.onError(task + ' failed, check the logs..')(err);
  };
}
1296149
function errorify (res) {
  var cwd = process.cwd()
  var count = res.errorCount + res.warningCount
  var err = new Error('' + count + (count === 1 ? ' issue' : ' issues') + ' found:')
  err.stack = '' + err.message

  res.results.forEach(function (result) {
    result.messages.forEach(function (message) {
      err.stack += ('\n    ' +
        result.filePath.replace(cwd, '').replace(/^\//, '') +
        ':' + message.line + ':' + message.column + ': ' +
        message.message + ' (' + message.ruleId + ')')
    })
  })

  return err
}
575069
function onerror(meta, err) {
    const { ok, sourceFrame, atLine } = options.utils.getCodeInfo({
      parsedArgv: options.parsedArgv,
      filename: meta.filename,
      err,
    });

    if (ok) {
      console.error(options.ansi.bold.bgRed('  CRITICAL  '), atLine);
      console.error(sourceFrame);
    } else {
      console.error(options.ansi.bold.bgRed('  CRITICAL  '));
      console.error(options.ansi.red(err.stack));
    }
    console.error('');
  }
749867
def throws_errors(func):
    
    @wraps(func)
    def wrapper(*args, **kwargs):
        response = func(*args, **kwargs)

        # if no status code is provided, assume 400
        if isinstance(response, BugZooException):
            err_jsn = flask.jsonify(response.to_dict())
            return err_jsn, 400

        if isinstance(response, tuple) \
           and isinstance(response[0], BugZooException):
            err = response[0] # type: BugZooException
            err_jsn = flask.jsonify(err.to_dict())
            return (err_jsn, *response[1:])

        return response

    return wrapper
81926
function writeError(chunk) {
    // in production give the output as-is
    if (NODE_ENV === "production") {
      return this.queue(chunk);
    }

    clearTimeout(errorTimer);
    errorChunks.push(chunk.toString());
    errorTimer = setTimeout(() => {
      this.queue(formatErrors(errorChunks.join("")));
    }, 10);
  }
897919
function logBlacklistError(err) {
  log.error(ansi.red('Error: failed to retrieve plugins black-list'));
  log.error(err.message); // Avoid duplicating for each version
  exit(1);
}
95351
function (err, req, res, next) {
    err = this.coerceError(err);

    if (err instanceof errors.NotFound && req.accepts('html')) {
      if (err instanceof errors.BinNotFound) {
        if (req.editor) {
          return (new BinHandler(this.sandbox)).notFound(req, res, next);
        }
      }

      return this.renderErrorPage('error', err, req, res);
    } else if (err instanceof errors.HTTPError) {
      // return this.renderError(err, req, res);
      return this.renderErrorPage(err.status, err, req, res);
    }

    if (err) {
      // console.error(err.stack);
    }

    next(err);
  }