File tree 3 files changed +10
-25
lines changed
src/main/kotlin/com/github/attacktive/troubleshootereditor/common/controller
3 files changed +10
-25
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2
2
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3
3
4
4
group = " com.github.attacktive"
5
- version = " 1.2.8 "
5
+ version = " 1.2.9 "
6
6
java.sourceCompatibility = JavaVersion .VERSION_21
7
7
8
8
plugins {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -2,15 +2,24 @@ package com.github.attacktive.troubleshootereditor.common.controller
2
2
3
3
import com.github.attacktive.troubleshootereditor.common.extension.logger
4
4
import com.github.attacktive.troubleshootereditor.ingamedata.common.ErrorResponse
5
+ import org.springframework.http.HttpStatus
5
6
import org.springframework.http.ResponseEntity
6
7
import org.springframework.http.converter.HttpMessageConversionException
7
8
import org.springframework.web.bind.annotation.ExceptionHandler
8
9
import org.springframework.web.bind.annotation.RestControllerAdvice
10
+ import org.springframework.web.servlet.resource.NoResourceFoundException
9
11
10
12
@RestControllerAdvice
11
13
class GlobalControllerExceptionHandler {
12
14
private val logger by logger()
13
15
16
+ @ExceptionHandler(NoResourceFoundException ::class )
17
+ fun handleNoResourceFoundException (exception : NoResourceFoundException ): ResponseEntity <ErrorResponse > {
18
+ logger.error(" Resource not found: /{}" , exception.resourcePath)
19
+
20
+ return ResponseEntity (ErrorResponse (exception), HttpStatus .NOT_FOUND )
21
+ }
22
+
14
23
@ExceptionHandler(HttpMessageConversionException ::class )
15
24
fun handleHttpMessageConversionException (exception : HttpMessageConversionException ): ResponseEntity <ErrorResponse > {
16
25
logger.error(exception.message, exception)
You can’t perform that action at this time.
0 commit comments