Skip to content

Commit

Permalink
feat: improved error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiastom committed Feb 24, 2017
1 parent 28f57a8 commit ff36ea4
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,20 @@ public function pull($branch = false)

public function kirbyChange($commitMessage)
{
$this->getRepo()->checkout($this->branch);
try {
$this->getRepo()->checkout($this->branch);

if ($this->pullOnChange) {
$this->pull();
}
if ($this->commitOnChange) {
$this->commit($commitMessage . "\n\nby " . site()->user());
}
if ($this->pushOnChange) {
$this->push();
if ($this->pullOnChange) {
$this->pull();
}
if ($this->commitOnChange) {
$this->commit($commitMessage . "\n\nby " . site()->user());
}
if ($this->pushOnChange) {
$this->push();
}
} catch(Exception $exception) {
trigger_error('Unable to update git: ' . $exception->getMessage());
}
}
}

0 comments on commit ff36ea4

Please sign in to comment.