Skip to content
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.

Commit

Permalink
Fix Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Jan 3, 2018
1 parent 529f65f commit 86ef7d8
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/Step/ConvertPages.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public function internalProcess()
}
if ($countError > 0) {
$message = sprintf('Errors: %s', $countError);
call_user_func_array($this->phpoole->getMessageCb(), ['CONVERT_PROGRESS', $message]);
//call_user_func_array($this->phpoole->getMessageCb(), ['CONVERT_PROGRESS', $message]);
call_user_func_array($this->phpoole->getMessageCb(), ['CONVERT_PROGRESS', $message, '-1']);
}
}

Expand All @@ -74,13 +75,21 @@ public function convertPage(Page $page, $format = 'yaml')
// converts frontmatter
try {
$variables = Converter::convertFrontmatter($page->getFrontmatter(), $format);
} catch (Exception $e) {
} catch (\Exception $e) {
$message = sprintf("> Unable to convert frontmatter of '%s': %s", $page->getId(), $e->getMessage());
call_user_func_array($this->phpoole->getMessageCb(), ['CONVERT_PROGRESS', $message]);
call_user_func_array($this->phpoole->getMessageCb(), ['CONVERT_PROGRESS', $message, -1]);

return false;
}
// set variables
try {
$page->setVariables($variables);
} catch (\Exception $e) {
$message = sprintf("> Unable to set variable in '%s': %s", $page->getId(), $e->getMessage());
call_user_func_array($this->phpoole->getMessageCb(), ['CONVERT_PROGRESS', $message, -1]);

return false;
}
$page->setVariables($variables);

// converts body
$html = Converter::convertBody($page->getBody());
Expand Down

0 comments on commit 86ef7d8

Please sign in to comment.