Skip to content

Commit

Permalink
Merge pull request #233 from oschettler/bugfix/issue-232
Browse files Browse the repository at this point in the history
Fixed issue #232 by catching the exception
  • Loading branch information
lGuillaume124 authored Jan 29, 2017
2 parents 9c2ecec + 8bf9b14 commit 75b1ff6
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/Console/Command/SonerezhShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,16 @@ public function import() {
}

$this->Song->create();
if (!$this->Song->save($parse_result['data'])) {
$this->overwrite("<error>[ERR]</error>[$file] - Unable to save the song metadata to the database");
$status = false;
$message = "<error>[ERR]</error>[$file] - Unable to save the song metadata to the database";
try {
$status = $this->Song->save($parse_result['data']);
}
catch (\Exception $e) {
$message = $e->getMessage();
}
if (!$status) {
$this->overwrite($message);
}

// Progressbar
Expand Down Expand Up @@ -155,4 +163,4 @@ public function refreshSyncToken() {
$settings['Setting']['sync_token'] = time();
$this->Setting->save($settings);
}
}
}

0 comments on commit 75b1ff6

Please sign in to comment.