Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix CHA CreateBillRunService result parsing
https://eaflood.atlassian.net/browse/WATER-3833 Found when working on [Add GlobalNotifier to the app](#100). If we get an error response from the [SROC Charging Module API](https://github.com/DEFRA/sroc-charging-module-api) we are able to parse the result without issue. This is because it will have a JSON body. But if Got throws an exception, which it will do if it fails to get a response, for example, when the request times out then `result.response` won't have a `body` property. This is causing the `_parseResult()` method to throw an error; `Unexpected token u in JSON at position 0`. This change updates `_parseResult()` in `CreateBillRunService` to be able to handle both scenarios.
- Loading branch information