| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2.0116 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | 7 | public static function populateFromClientException(ClientException $e) |
|
| 25 | { |
||
| 26 | 7 | $body = $e->getResponse()->getBody(); |
|
| 27 | 7 | $data = json_decode($body); |
|
| 28 | |||
| 29 | // find out what kind of error happend and give some extra help |
||
| 30 | 7 | if (strpos($data->reason, 'inequivalent arg \'durable\'') !== false) { |
|
| 31 | $data->cause = 'Queue already exists with different durable stat, delete the queue first'; |
||
| 32 | } |
||
| 33 | |||
| 34 | 7 | $res = new Response($e->getCode(), $e->getResponse()->getHeaders(), json_encode($data)); |
|
| 35 | 7 | return new JobResult($res); |
|
| 36 | } |
||
| 37 | |||
| 63 |