Conditions | 5 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public static function reportError(OutputInterface $output, Throwable $throwable): int |
||
16 | { |
||
17 | try { |
||
18 | throw $throwable; |
||
19 | } catch (InvalidConfigException $e) { |
||
20 | self::writeToStdError($output, "<error>{$e->getMessage()}</error>"); |
||
21 | |||
22 | return 2; |
||
23 | } catch (BaseLineImportException $e) { |
||
24 | self::writeToStdError($output, "<error>{$e->getMessage()}</error>"); |
||
25 | |||
26 | return 3; |
||
27 | } catch (SarbException $e) { |
||
28 | self::writeToStdError($output, "<error>Something went wrong: {$e->getMessage()}"); |
||
29 | |||
30 | return 4; |
||
31 | } catch (Throwable $e) { |
||
32 | // This should never happen. All exceptions should extend SarbException |
||
33 | self::writeToStdError($output, "<error>Unexpected critical error: {$e->getMessage()}</error>"); |
||
34 | |||
35 | return 5; |
||
36 | } |
||
45 |