Skip to content

Commit 2431324

Browse files
Add rudimentary exceptions differentiation
1 parent 92d246f commit 2431324

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/ApiWrapper.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
namespace EventStudyTools\ApiWrapper;
33

44
use EventStudyTools\ApiWrapper\ApplicationInput\ApplicationInputInterface;
5+
use EventStudyTools\ApiWrapper\Exception\ApiSemanticException;
56

67
class ApiWrapper
78
{
@@ -308,9 +309,9 @@ public function processTask()
308309
$result = json_decode($result);
309310

310311
if (isset($result->error)) {
311-
throw new \Exception($result->error);
312+
throw new ApiSemanticException($result->error);
312313
} else {
313-
throw new \Exception('Application launch error');
314+
throw new ApiSemanticException('Application launch error');
314315
}
315316
}
316317

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace EventStudyTools\ApiWrapper\Exception;
4+
5+
6+
class ApiSemanticException extends \Exception
7+
{
8+
9+
}

0 commit comments

Comments
 (0)