<commit_before><?php
namespace Sprockets\Filter;

use Sprockets\File;

class Scss extends Base
{
	private $parser;

	public function __construct()
	{
		$previous_error_reporting = error_reporting();
		error_reporting(E_ERROR);

		$this->parser = new \SassParser(array('syntax' => \SassFile::SCSS));

		error_reporting($previous_error_reporting);
	}
	
	public function __invoke($content, $file, $dir, $vars)
	{
		$content = preg_replace_callback('/@import\s+["\']([a-z0-9\/]+)["\']/i', function ($match) use ($dir)
		{
			if ($match[1] == '/')
				$filename = $match;
			else
				$filename = $dir . '/' . $match[1];

			if ($this->pipeline->locator->hasFile($filename, 'css'))
				$file = new File($filename . '.css');
			else if ($this->pipeline->locator->hasFile($index_file = $filename . '/index', 'css'))
				$file = new File($index_file . '.css');
			else
				throw new \Sprockets\Exception\FileNotFound($file, 'css');

			return '@import "' . str_replace('//', '/', $file->getFilepath()) . '"';
		}, $content);

		$content = $this->parser->toCss($content, false);

		return $content;
	}
}<commit_msg>Fix exception to use the filename instead of a blank string.<commit_after><?php
namespace Sprockets\Filter;

use Sprockets\File;

class Scss extends Base
{
	private $parser;

	public function __construct()
	{
		$previous_error_reporting = error_reporting();
		error_reporting(E_ERROR);

		$this->parser = new \SassParser(array('syntax' => \SassFile::SCSS));

		error_reporting($previous_error_reporting);
	}
	
	public function __invoke($content, $file, $dir, $vars)
	{
		$content = preg_replace_callback('/@import\s+["\']([a-z0-9\/]+)["\']/i', function ($match) use ($dir)
		{
			if ($match[1] == '/')
				$filename = $match;
			else
				$filename = $dir . '/' . $match[1];

			if ($this->pipeline->locator->hasFile($filename, 'css'))
				$file = new File($filename . '.css');
			else if ($this->pipeline->locator->hasFile($index_file = $filename . '/index', 'css'))
				$file = new File($index_file . '.css');
			else
				throw new \Sprockets\Exception\FileNotFound($filename, 'css');

			return '@import "' . str_replace('//', '/', $file->getFilepath()) . '"';
		}, $content);

		$content = $this->parser->toCss($content, false);

		return $content;
	}
}
{'fraction_non_alphanumeric': 0.20477664750110572, 'fraction_numerical': 0.0035382574082264487, 'mean_word_length': 4.026666666666666, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '3370624', 'n_tokens_mistral': 873, 'n_tokens_neox': 773, 'n_words': 158}