Skip to content

Commit 15b6afd

Browse files
committed
Add some error handling, to make debuging a touch easier
1 parent 1e03681 commit 15b6afd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

source/functions.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,18 @@ function defer($code) {
5252
";
5353

5454
$result = exec(
55-
"php -r 'eval(base64_decode(\"" . base64_encode($defer) . "\"));'"
55+
"php -r 'eval(base64_decode(\"" . base64_encode($defer) . "\"));'",
56+
$output
5657
);
5758

58-
return gzdecode(base64_decode($result));
59+
60+
$return = @gzdecode(base64_decode($result));
61+
62+
if ($return === false) {
63+
throw new \RuntimeException("defer failed due to " . implode("\n", $output));
64+
}
65+
66+
return $return;
5967
}
6068
}
6169

0 commit comments

Comments
 (0)