<commit_before>'use strict';
const got = require('got');
const config = require('./config');


function start(url) {
    return got.post(url, {
        timeout: 5000,
        body: JSON.stringify({
            response_type: 'in_channel',
            text: "Would you like to join today's Lunch Shuffle?",
            attachments: [{
                fallback: "You're unable to join the lunch shuffle",
                callback_id: 'join',
                actions: [{
                    name: 'yes',
                    text: 'Yes! 😎',
                    type: 'button',
                    style: 'primary',
                }, {
                    name: 'no',
                    text: 'No 😞',
                    type: 'button',
                    style: 'danger',
                    confirm: {
                        title: 'Are you sure?',
                        text: 'Your awesome colleagues will be disappointed...',
                        ok_text: 'Yes',
                        dismiss_text: 'No',
                    }
                }]
            }]
        }),
    }).then((response) => {
        console.log(response.body);
    }).catch((error) => {
        console.error(error);
    });
}

function *route() {
    if (this.request.body.token !== config.SLACK_VERIFICATION_TOKEN) {
        this.response.status = 401;
        return;
    }

    const subcommand = this.request.body.text;

    console.log(this.request.body);

    if (subcommand === 'start') {
        this.body = '';
        start(this.request.body.response_url);
    } else if (subcommand === 'cancel') {
        this.body = 'Cancelling the lunch shuffle...';
    } else {
        this.body = "Sorry, I didn't recognise that subcommand. Valid subcommands are `start` and `cancel`.";
    }
}

module.exports = route;
<commit_msg>Don't catch errors from .then() callback<commit_after>'use strict';
const got = require('got');
const config = require('./config');


function start(url) {
    return got.post(url, {
        timeout: 5000,
        body: JSON.stringify({
            response_type: 'in_channel',
            text: "Would you like to join today's Lunch Shuffle?",
            attachments: [{
                fallback: "You're unable to join the lunch shuffle",
                callback_id: 'join',
                actions: [{
                    name: 'yes',
                    text: 'Yes! 😎',
                    type: 'button',
                    style: 'primary',
                }, {
                    name: 'no',
                    text: 'No 😞',
                    type: 'button',
                    style: 'danger',
                    confirm: {
                        title: 'Are you sure?',
                        text: 'Your awesome colleagues will be disappointed...',
                        ok_text: 'Yes',
                        dismiss_text: 'No',
                    }
                }]
            }]
        }),
    }).then((response) => {
        console.log(response.body);
    }, (error) => {
        console.error(error);
    });
}

function *route() {
    if (this.request.body.token !== config.SLACK_VERIFICATION_TOKEN) {
        this.response.status = 401;
        return;
    }

    const subcommand = this.request.body.text;

    console.log(this.request.body);

    if (subcommand === 'start') {
        this.body = '';
        start(this.request.body.response_url);
    } else if (subcommand === 'cancel') {
        this.body = 'Cancelling the lunch shuffle...';
    } else {
        this.body = "Sorry, I didn't recognise that subcommand. Valid subcommands are `start` and `cancel`.";
    }
}

module.exports = route;

{'fraction_non_alphanumeric': 0.13391637059305822, 'fraction_numerical': 0.0038261820169445205, 'mean_word_length': 1.3937213865271418, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5849822', 'n_tokens_mistral': 1031, 'n_tokens_neox': 945, 'n_words': 243}