diff --git a/app/uk/gov/hmrc/apipublisher/controllers/PublisherController.scala b/app/uk/gov/hmrc/apipublisher/controllers/PublisherController.scala index 3a7c710..d3234ad 100644 --- a/app/uk/gov/hmrc/apipublisher/controllers/PublisherController.scala +++ b/app/uk/gov/hmrc/apipublisher/controllers/PublisherController.scala @@ -55,11 +55,21 @@ class PublisherController @Inject() ( private val ER = EitherTHelper.make[Result] private val mapBusinessErrorsToResults: PublishError => Result = _ match { - case err: DefinitionFileNotFound => BadRequest(error(ErrorCode.INVALID_API_DEFINITION, err.message)) - case err: DefinitionFileNoBodyReturned => BadRequest(error(ErrorCode.INVALID_API_DEFINITION, err.message)) - case err: DefinitionFileUnprocessableEntity => UnprocessableEntity(error(ErrorCode.INVALID_API_DEFINITION, err.message)) - case err: DefinitionFileFailedSchemaValidation => UnprocessableEntity(error(ErrorCode.INVALID_API_DEFINITION, Json.toJson(err.error))) - case err: GenericValidationFailure => BadRequest(error(ErrorCode.INVALID_API_DEFINITION, err.message)) + case err: DefinitionFileNotFound => + logger.warn(s"${ErrorCode.INVALID_API_DEFINITION} - DefinitionFileNotFound: ${err.message}") + BadRequest(error(ErrorCode.INVALID_API_DEFINITION, err.message)) + case err: DefinitionFileNoBodyReturned => + logger.warn(s"${ErrorCode.INVALID_API_DEFINITION} - DefinitionFileNoBodyReturned: ${err.message}") + BadRequest(error(ErrorCode.INVALID_API_DEFINITION, err.message)) + case err: DefinitionFileUnprocessableEntity => + logger.warn(s"${ErrorCode.INVALID_API_DEFINITION} - DefinitionFileUnprocessableEntity: ${err.message}") + UnprocessableEntity(error(ErrorCode.INVALID_API_DEFINITION, err.message)) + case err: DefinitionFileFailedSchemaValidation => + logger.warn(s"${ErrorCode.INVALID_API_DEFINITION} - DefinitionFileFailedSchemaValidation: ${err.message}") + UnprocessableEntity(error(ErrorCode.INVALID_API_DEFINITION, Json.toJson(err.error))) + case err: GenericValidationFailure => + logger.warn(s"${ErrorCode.INVALID_API_DEFINITION} - GenericValidationFailure: ${err.message}") + BadRequest(error(ErrorCode.INVALID_API_DEFINITION, err.message)) } private def ensureAuthorised(implicit request: Request[JsValue]): Option[Result] = {