Skip to content

Commit

Permalink
trim() around the exception
Browse files Browse the repository at this point in the history
  • Loading branch information
jamierumbelow committed May 1, 2012
1 parent dd93ec9 commit 4a341a4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sass.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

#include "php_sass.h"
#include "utilities.h"

/* --------------------------------------------------------------
* Sass
Expand Down Expand Up @@ -47,7 +48,7 @@ PHP_METHOD(Sass, parse)
// Check the context for any errors...
if (context->error_status)
{
zend_throw_exception(sass_exception_ce, context->error_message, 0 TSRMLS_CC);
zend_throw_exception(sass_exception_ce, trim(context->error_message), 0 TSRMLS_CC);
}

// Do we have an output?
Expand Down
19 changes: 19 additions & 0 deletions tests/throw_exception.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
If there's an error while parsing, throw a SassException
--SKIPIF--
<?php if (!extension_loaded("sass")) print "skip"; ?>
--FILE--
<?php

try
{
Sass::parse('askdgauwydv7iq2dq');
}
catch (SassException $e)
{
echo 'Exception caught';
}

?>
--EXPECT--
Exception caught

0 comments on commit 4a341a4

Please sign in to comment.