summaryrefslogtreecommitdiff
path: root/src/Script/Console.php
diff options
context:
space:
mode:
authorFbenas <philbeansburton@gmail.com>2018-05-07 15:02:39 +0100
committerFbenas <philbeansburton@gmail.com>2018-05-07 15:02:39 +0100
commit8350b6bd36d3a4bb3a99dfbf67e746f4f815927c (patch)
treed7cf04d2343ca031a8f241f204e4227eb6b48016 /src/Script/Console.php
parent33f00442f1667d57f94433834e0da4985670025b (diff)
Add some simple exception handling for bad inputs
Diffstat (limited to 'src/Script/Console.php')
-rw-r--r--src/Script/Console.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Script/Console.php b/src/Script/Console.php
index e1d7df5..3228750 100644
--- a/src/Script/Console.php
+++ b/src/Script/Console.php
@@ -5,6 +5,7 @@ namespace App\Script;
use App\Model\Vendor;
use App\Script\Input;
use App\Script\Output;
+use Exception;
/**
* Main application class
@@ -44,12 +45,16 @@ class Console
*/
public function exec()
{
- $input = new Input;
- $vendors = Vendor::loadAll($input->getOption('f'));
+ $output = new Output;
+ try {
+ $input = new Input;
+ $vendors = Vendor::loadAll($input->getOption('f'));
- $vendors->filterByInput($input);
+ $vendors->filterByInput($input);
- $output = new Output;
- $output->printCollection($vendors);
+ $output->printCollection($vendors);
+ } catch (Exception $e) {
+ $output->printException($e);
+ }
}
}