<commit_before>Template.postSubmit.events({
  'submit form': function(e) {
    e.preventDefault();

    var post = {
      url: $(e.target).find('[name=url]').val(),
      title: $(e.target).find('[name=title]').val()
    };

    post.slug = slugify(post.title);

    Meteor.call('postInsert', post, function(error, result) {
      // display the error to the user and abort
      if (error)
        return alert(error.reason);
      Router.go('postPage', {_id: result._id});  
    });
  }
});<commit_msg>Set alert error instead of stopping<commit_after>Template.postSubmit.events({
  'submit form': function(e) {
    e.preventDefault();

    var post = {
      url: $(e.target).find('[name=url]').val(),
      title: $(e.target).find('[name=title]').val()
    };

    post.slug = slugify(post.title);

    Meteor.call('postInsert', post, function(error, result) {
       // show this result but route anyway
      if (result.postExists)
        alert('This link has already been posted');
      Router.go('postPage', {_id: result._id});  
    });
  }
});
{'fraction_non_alphanumeric': 0.18388625592417063, 'fraction_numerical': 0.0, 'mean_word_length': 2.955056179775281, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2126843', 'n_tokens_mistral': 347, 'n_tokens_neox': 340, 'n_words': 71}