Simplify conditional expression

This commit is contained in:
Mikhail Yasnov 2021-06-16 21:42:07 +03:00
parent 11fcb7a586
commit 6a08c4568b
2 changed files with 6 additions and 5 deletions

View File

@ -6,6 +6,7 @@ plugins {
dependencies {
api(project(":common"))
api(project(":common-spring"))
api(project(":common-spring-web"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")

View File

@ -1,21 +1,21 @@
package ru.touchin.exception.handler.spring.resolvers
import org.springframework.core.Ordered
import org.springframework.core.annotation.Order
import org.springframework.stereotype.Component
import ru.touchin.common.exceptions.CommonNotFoundException
import ru.touchin.common.spring.Ordered
import ru.touchin.exception.handler.dto.ExceptionResolverResult
@Order(Ordered.LOWEST_PRECEDENCE - 1)
@Order(Ordered.LOW)
@Component
class NotFoundExceptionResolver : ExceptionResolver {
override fun invoke(exception: Exception): ExceptionResolverResult? {
return if (exception is CommonNotFoundException) {
if (exception !is CommonNotFoundException) {
ExceptionResolverResult.createNotFoundError(exception)
} else {
null
}
return null
}
}