<commit_before>'use strict';

const HTTPSnippet = require('httpsnippet');
const harGenerator = require('./harGenerator');

function generate(target, client, data) {
    try {
        const request = harGenerator.generate(data);
        const snippet = new HTTPSnippet(request);
        return snippet.convert(target, client) || '';
    }
    catch (ex) {
        console.warn('Error generating code sample using httpsnippet for', target, client);
        return '';
    }
}

module.exports = {
    generate
};<commit_msg>httpsnippetGenerator; show exceptions if verbose is true<commit_after>'use strict';

const HTTPSnippet = require('httpsnippet');
const harGenerator = require('./harGenerator');

function generate(target, client, data) {
    try {
        const request = harGenerator.generate(data);
        const snippet = new HTTPSnippet(request);
        return snippet.convert(target, client) || '';
    }
    catch (ex) {
        console.warn('Error generating code sample using httpsnippet for', target, client);
        if (data.options.verbose) console.warn(ex.message);
        return '';
    }
}

module.exports = {
    generate
};
{'fraction_non_alphanumeric': 0.1240174672489083, 'fraction_numerical': 0.0, 'mean_word_length': 3.340909090909091, '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': '6851569', 'n_tokens_mistral': 310, 'n_tokens_neox': 308, 'n_words': 83}