Skip to content

Commit

Permalink
Merge pull request #58 from dreamfactorysoftware/df-scheduler
Browse files Browse the repository at this point in the history
Add throw exception to df:request command
  • Loading branch information
yaroslavmo authored Nov 26, 2019
2 parents f350f83 + bf885ff commit 9a7ca9c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Commands/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace DreamFactory\Core\Commands;

use DreamFactory\Core\Enums\DataFormats;
use DreamFactory\Core\Exceptions\InternalServerErrorException;
use DreamFactory\Core\Utility\FileUtilities;
use Illuminate\Console\Command;
use ServiceManager;
Expand Down Expand Up @@ -59,13 +60,15 @@ public function handle()
$result = ServiceManager::handleRequest($service, $verb, $resource, [], [], $data, $format, false);
if ($result->getStatusCode() >= 300) {
$this->error(print_r($result, true));
throw new InternalServerErrorException($result->getContent()['error']['message'], $result->getStatusCode());
} else {
$this->info(print_r($result, true));
}

$this->info('Request complete!');
} catch (\Exception $e) {
$this->error($e->getMessage());
throw new InternalServerErrorException($e->getMessage());
}
}
}

0 comments on commit 9a7ca9c

Please sign in to comment.