From 70caf2da915f71138e3744aa1834e81a69cade85 Mon Sep 17 00:00:00 2001 From: Denis Savosin Date: Mon, 21 Oct 2024 17:49:32 +0700 Subject: [PATCH] some fixes --- .gitignore | 1 + .../dannecron/demo/http/controllers/ProductController.kt | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 47380be..45fb694 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ bin/ ### IntelliJ IDEA ### .idea +.gigaide *.iws *.iml *.ipr diff --git a/src/main/kotlin/com/github/dannecron/demo/http/controllers/ProductController.kt b/src/main/kotlin/com/github/dannecron/demo/http/controllers/ProductController.kt index 4774b1b..f73d73f 100644 --- a/src/main/kotlin/com/github/dannecron/demo/http/controllers/ProductController.kt +++ b/src/main/kotlin/com/github/dannecron/demo/http/controllers/ProductController.kt @@ -8,8 +8,8 @@ import com.github.dannecron.demo.http.responses.makeOkResponse import com.github.dannecron.demo.http.responses.page.PageResponse import com.github.dannecron.demo.models.Product import com.github.dannecron.demo.services.database.exceptions.AlreadyDeletedException -import com.github.dannecron.demo.services.database.product.ProductService import com.github.dannecron.demo.services.database.exceptions.ProductNotFoundException +import com.github.dannecron.demo.services.database.product.ProductService import com.github.dannecron.demo.services.kafka.exceptions.InvalidArgumentException import io.swagger.v3.oas.annotations.media.Content import io.swagger.v3.oas.annotations.media.Schema @@ -72,7 +72,7 @@ class ProductController( ): ResponseEntity { try { productService.syncToKafka(guid, topic) - } catch (exception: InvalidArgumentException) { + } catch (_: InvalidArgumentException) { throw UnprocessableException("cannot sync product to kafka") } @@ -99,9 +99,9 @@ class ProductController( ): ResponseEntity { try { productService.delete(guid) - } catch (notFoundException: ProductNotFoundException) { + } catch (_: ProductNotFoundException) { throw NotFoundException() - } catch (alreadyDeletedException: AlreadyDeletedException) { + } catch (_: AlreadyDeletedException) { throw UnprocessableException("product already deleted") }