Skip to content

Commit

Permalink
Use the custom exception
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed May 25, 2022
1 parent 89f552d commit 92939f3
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/Commands/HydeMakePageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Hyde\Framework\Commands;

use Exception;
use Hyde\Framework\Actions\CreatesNewPageSourceFile;
use Hyde\Framework\Exceptions\UnsupportedPageTypeException;
use Hyde\Framework\Models\BladePage;
use Hyde\Framework\Models\DocumentationPage;
use Hyde\Framework\Models\MarkdownPage;
Expand Down Expand Up @@ -50,10 +50,6 @@ class HydeMakePageCommand extends Command

/**
* Execute the console command.
*
* @return int the exit code of the command.
*
* @throws Exception if the page type is invalid.
*/
public function handle(): int
{
Expand All @@ -71,7 +67,7 @@ public function handle(): int

$creator = new CreatesNewPageSourceFile($this->title, $this->type, $this->force);

$this->info("Created file $creator->path");
$this->info("Created file $creator->outputPath");

return 0;
}
Expand All @@ -81,7 +77,7 @@ public function handle(): int
*
* @return void
*
* @throws Exception if the page type is invalid.
* @throws UnsupportedPageTypeException if the page type is invalid.
*/
protected function validateOptions(): void
{
Expand All @@ -104,6 +100,6 @@ protected function validateOptions(): void
return;
}

throw new Exception("Invalid page type: $type", 400);
throw new UnsupportedPageTypeException("Invalid page type: $type", 400);
}
}

0 comments on commit 92939f3

Please sign in to comment.