mirror of
https://github.com/there4/markdown-resume.git
synced 2024-12-03 08:59:35 -05:00
Fix error handling in the generateHtml method of the html command to throw exceptions
This commit is contained in:
parent
ca002ff417
commit
5d3e062b96
@ -73,15 +73,7 @@ class HtmlCommand extends Command
|
|||||||
{
|
{
|
||||||
// Check that the source file is sane
|
// Check that the source file is sane
|
||||||
if (!file_exists($source)) {
|
if (!file_exists($source)) {
|
||||||
$output->writeln(
|
throw new \Exception("Unable to open source file: $source");
|
||||||
sprintf(
|
|
||||||
'<error>Unable to open source file: %s</error>',
|
|
||||||
$source
|
|
||||||
),
|
|
||||||
$this->app->outputFormat
|
|
||||||
);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that our template is sane, or set to the default one
|
// Check that our template is sane, or set to the default one
|
||||||
@ -90,16 +82,9 @@ class HtmlCommand extends Command
|
|||||||
}
|
}
|
||||||
$templatePath = join(DIRECTORY_SEPARATOR, array($this->app->templatePath, basename($template)));
|
$templatePath = join(DIRECTORY_SEPARATOR, array($this->app->templatePath, basename($template)));
|
||||||
$templateIndexPath = join(DIRECTORY_SEPARATOR, array($templatePath, 'index.html'));
|
$templateIndexPath = join(DIRECTORY_SEPARATOR, array($templatePath, 'index.html'));
|
||||||
if (!file_exists($templateIndexPath)) {
|
|
||||||
$output->writeln(
|
|
||||||
sprintf(
|
|
||||||
'<error>Unable to open template file: %s</error>',
|
|
||||||
$templateIndexPath
|
|
||||||
),
|
|
||||||
$this->app->outputFormat
|
|
||||||
);
|
|
||||||
|
|
||||||
return false;
|
if (!file_exists($templateIndexPath)) {
|
||||||
|
throw new \Exception("Unable to open template file: $templateIndexPath");
|
||||||
}
|
}
|
||||||
|
|
||||||
// We build these into a single string so that we can deploy this resume as a
|
// We build these into a single string so that we can deploy this resume as a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user