Skip to content

Commit

Permalink
Fix CHA CreateBillRunService result parsing
Browse files Browse the repository at this point in the history
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
Cruikshanks committed Jan 31, 2023
1 parent 1a52bf3 commit 4129d27
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 4129d27

Please sign in to comment.