<commit_before>var through = require('through2'),
    gutil = require('gulp-util'),
    rasterize = require('./lib'),
    PluginError = gutil.PluginError;

const PLUGIN_NAME = 'gulp-raster';

module.exports = function (opt) {
    'use strict';

    opt = opt || {};
    opt.scale = opt.scale || 1;
    opt.format = opt.format || 'png';

    function raster(file, enc, callback) {
        var that = this;

        // Do nothing if no contents
        if (file.isNull()) { return callback(); }

        if (file.isBuffer()) {
            rasterize(file.path, opt.format, opt.scale, function (err, data) {
                if (err) { throw new PluginError(PLUGIN_NAME, 'Error occured during file conversion'); }

                file.contents = data;
                that.push(file);
                return callback();
            });
        }
    }

    return through.obj(raster);
};<commit_msg>show full error message<commit_after>var through = require('through2'),
    gutil = require('gulp-util'),
    rasterize = require('./lib'),
    PluginError = gutil.PluginError;

const PLUGIN_NAME = 'gulp-raster';

module.exports = function (opt) {
    'use strict';

    opt = opt || {};
    opt.scale = opt.scale || 1;
    opt.format = opt.format || 'png';

    function raster(file, enc, callback) {
        var that = this;

        // Do nothing if no contents
        if (file.isNull()) { return callback(); }

        if (file.isBuffer()) {
            rasterize(file.path, opt.format, opt.scale, function (err, data) {
                if (err) { throw new PluginError(PLUGIN_NAME, err); }

                file.contents = data;
                that.push(file);
                return callback();
            });
        }
    }

    return through.obj(raster);
};
{'fraction_non_alphanumeric': 0.14277620396600565, 'fraction_numerical': 0.0022662889518413596, 'mean_word_length': 2.055363321799308, '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': '4052886', 'n_tokens_mistral': 544, 'n_tokens_neox': 517, 'n_words': 131}