mirror of
https://github.com/Dannecron/spring-boot-demo.git
synced 2025-12-25 16:22:35 +03:00
some fixes
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -18,6 +18,7 @@ bin/
|
|||||||
|
|
||||||
### IntelliJ IDEA ###
|
### IntelliJ IDEA ###
|
||||||
.idea
|
.idea
|
||||||
|
.gigaide
|
||||||
*.iws
|
*.iws
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
|
|||||||
@@ -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.http.responses.page.PageResponse
|
||||||
import com.github.dannecron.demo.models.Product
|
import com.github.dannecron.demo.models.Product
|
||||||
import com.github.dannecron.demo.services.database.exceptions.AlreadyDeletedException
|
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.exceptions.ProductNotFoundException
|
||||||
|
import com.github.dannecron.demo.services.database.product.ProductService
|
||||||
import com.github.dannecron.demo.services.kafka.exceptions.InvalidArgumentException
|
import com.github.dannecron.demo.services.kafka.exceptions.InvalidArgumentException
|
||||||
import io.swagger.v3.oas.annotations.media.Content
|
import io.swagger.v3.oas.annotations.media.Content
|
||||||
import io.swagger.v3.oas.annotations.media.Schema
|
import io.swagger.v3.oas.annotations.media.Schema
|
||||||
@@ -72,7 +72,7 @@ class ProductController(
|
|||||||
): ResponseEntity<Any> {
|
): ResponseEntity<Any> {
|
||||||
try {
|
try {
|
||||||
productService.syncToKafka(guid, topic)
|
productService.syncToKafka(guid, topic)
|
||||||
} catch (exception: InvalidArgumentException) {
|
} catch (_: InvalidArgumentException) {
|
||||||
throw UnprocessableException("cannot sync product to kafka")
|
throw UnprocessableException("cannot sync product to kafka")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,9 +99,9 @@ class ProductController(
|
|||||||
): ResponseEntity<Any> {
|
): ResponseEntity<Any> {
|
||||||
try {
|
try {
|
||||||
productService.delete(guid)
|
productService.delete(guid)
|
||||||
} catch (notFoundException: ProductNotFoundException) {
|
} catch (_: ProductNotFoundException) {
|
||||||
throw NotFoundException()
|
throw NotFoundException()
|
||||||
} catch (alreadyDeletedException: AlreadyDeletedException) {
|
} catch (_: AlreadyDeletedException) {
|
||||||
throw UnprocessableException("product already deleted")
|
throw UnprocessableException("product already deleted")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user