<?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;
	}
}

<?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;
	}
}

Fix exception to use the filename instead of a blank string.
Fix exception to use the filename instead of a blank string.

The exception was not reporting the problem file due to using the wrong
variable.
