From 54024a6b3c7936c79e17e43ab21ec613a96fe5d6 Mon Sep 17 00:00:00 2001 From: Narendra Vijayarao Date: Wed, 18 Apr 2018 15:59:39 +0100 Subject: [PATCH] MTDSA-1432 Improve logging for VAT API --- .../resources/wrappers/FinancialDataResponse.scala | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/uk/gov/hmrc/vatapi/resources/wrappers/FinancialDataResponse.scala b/app/uk/gov/hmrc/vatapi/resources/wrappers/FinancialDataResponse.scala index 949020b8..fe851392 100644 --- a/app/uk/gov/hmrc/vatapi/resources/wrappers/FinancialDataResponse.scala +++ b/app/uk/gov/hmrc/vatapi/resources/wrappers/FinancialDataResponse.scala @@ -30,13 +30,17 @@ case class FinancialDataResponse(underlying: HttpResponse) extends Response { def getLiabilities(vrn: Vrn): Either[DesTransformError, Liabilities] = { def deserialise(js: JsValue) = js.validate[des.FinancialData] match { - case JsError(errors) => Left(ParseError(s"Unable to parse the response from DES as Json: $errors")) + case JsError(errors) => Left(ParseError(s"[FinancialDataResponse][getLiabilities - deserialise] Json format from DES doesn't match the FinancialData model: $errors")) case JsSuccess(financialData, _) => DesTransformValidator[des.FinancialData, Liabilities].from(financialData) } jsonOrError match { - case Right(js) => deserialise(js) - case Left(e) => Left(ParseError(s"Unable to parse the response from DES as Json: $e")) + case Right(js) => + logger.info(s"[FinancialDataResponse][getLiabilities - jsonOrError] Json response body from DES : ${js}") + deserialise(js) + case Left(e) => + logger.error(s"[FinancialDataResponse][getLiabilities - jsonOrError] Non json response from DES : ${underlying.body}") + Left(ParseError(s"Unable to parse the response from DES as Json: $e")) } }