<commit_before>require('dotenv').load();
var fs = require('fs');
var sendgrid_username = process.env.SENDGRID_USERNAME;
var sendgrid_password = <PASSWORD>.env.SENDGRID_PASSWORD;
var from = process.env.FROM;
var from_name = process.env.FROM_NAME;

var app = require('express')();
app.post('/vp', function(req, res) {
  var err;
  try {
    var multiparty = require('multiparty');
    var form = new multiparty.Form();
    form.parse(req, function(err, fields, files){
        console.log(require('util').inspect(fields, false));

        fs.readFile('./mail.txt', 'utf8', function(err, text) {
          var sender = fields.from[0];
          var subject = fields.subject;
          var reg = /[A-Za-z0-9\-\.\_]+@[A-Za-z0-9\-\_]+\.[A-Za-z0-9\-\.\_]+/;
          var email = sender.match(reg);
          var sendgrid = require('sendgrid')(sendgrid_username, sendgrid_password);
          var sgMail = new sendgrid.Email();
          var a = 1 / 0;
          sgMail.addTo(email);
          sgMail.setFrom(from);
          sgMail.fromname = from_name;
          sgMail.setSubject('Re: ' + subject);
          sgMail.setText(text + '\r\n' + from_name + '\r\n' + from);
          sendgrid.send(sgMail, function(err, json){
            if (err) { return console.error(err);}
            console.log(json);
          });
        });
    }); 
  } catch (e) {
    console.log(e);
    err = e;
  } finally {
    res.send(err);
  }
});

app.listen(process.env.PORT || 7076);<commit_msg>add error<commit_after>require('dotenv').load();
var fs = require('fs');
var sendgrid_username = process.env.SENDGRID_USERNAME;
var sendgrid_password = process.env.SENDGRID_PASSWORD;
var from = process.env.FROM;
var from_name = process.env.FROM_NAME;

var app = require('express')();
app.post('/vp', function(req, res) {
  var err;
  try {
    var multiparty = require('multiparty');
    var form = new multiparty.Form();
    form.parse(req, function(err, fields, files){
        console.log(require('util').inspect(fields, false));

        fs.readFile('./あmail.txt', 'utf8', function(err, text) {
          var sender = fields.from[0];
          var subject = fields.subject;
          var reg = /[A-Za-z0-9\-\.\_]+@[A-Za-z0-9\-\_]+\.[A-Za-z0-9\-\.\_]+/;
          var email = sender.match(reg);
          var sendgrid = require('sendgrid')(sendgrid_username, sendgrid_password);
          var sgMail = new sendgrid.Email();
          sgMail.addTo(email);
          sgMail.setFrom(from);
          sgMail.fromname = from_name;
          sgMail.setSubject('Re: ' + subject);
          sgMail.setText(text + '\r\n' + from_name + '\r\n' + from);
          sendgrid.send(sgMail, function(err, json){
            if (err) { return console.error(err);}
            console.log(json);
          });
        });
    }); 
  } catch (e) {
    console.log(e);
    err = e;
  } finally {
    res.send(err);
  }
});

app.listen(process.env.PORT || 7076);
{'fraction_non_alphanumeric': 0.17655125128556737, 'fraction_numerical': 0.008913267055193692, 'mean_word_length': 2.469678953626635, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7666966', 'n_tokens_mistral': 1024, 'n_tokens_neox': 989, 'n_words': 184}