From 7cee2b30517cfbf4144f79a7f7f6b23f1cf1ac0c Mon Sep 17 00:00:00 2001
From: Michiel Rook <mrook@php.net>
Date: Mon, 18 Nov 2024 11:42:26 +0100
Subject: [PATCH] Refs #1863 - show sass error messages in failed builds

---
 src/Phing/Task/Ext/Sass/SassCompiler.php | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/Phing/Task/Ext/Sass/SassCompiler.php b/src/Phing/Task/Ext/Sass/SassCompiler.php
index b8a7a16da..1b782c20f 100644
--- a/src/Phing/Task/Ext/Sass/SassCompiler.php
+++ b/src/Phing/Task/Ext/Sass/SassCompiler.php
@@ -49,18 +49,11 @@ public function __construct(string $executable, string $flags)
      */
     public function compile(string $inputFilePath, string $outputFilePath, bool $failOnError): void
     {
-        try {
-            $output = $this->executeCommand($inputFilePath, $outputFilePath);
-            if ($failOnError && $output[0] !== 0) {
-                throw new BuildException(
-                    "Result returned as not 0. Result: {$output[0]}",
-                    Project::MSG_INFO
-                );
-            }
-        } catch (Exception $e) {
-            if ($failOnError) {
-                throw new BuildException($e);
-            }
+        list($return, $output) = $this->executeCommand($inputFilePath, $outputFilePath);
+        if ($failOnError && $return !== 0) {
+            throw new BuildException(
+                "Sass exited with return code {$return} and message '{$output[0]}'"
+            );
         }
     }