function withErrorHandling($callback)
{
try {
call_user_func($callback);
return 0;
} catch (\Exception $e) {
$this->logger()->err(sprintf("Build failed: %s (use --trace to get a stack trace)", $e->getMessage()));
if ($this->trace) {
$this->logger()->info($e->getTraceAsString());
}
return 1;
}
}