Add exception handler

This commit is contained in:
2023-10-05 21:10:05 +08:00
parent 6a9ad8d490
commit 78de04713f
7 changed files with 135 additions and 3 deletions

View File

@@ -0,0 +1,14 @@
package top.fatweb.api.controller
import jakarta.servlet.http.HttpServletRequest
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/error")
class ExceptionController {
@RequestMapping("/thrown")
fun thrown(request: HttpServletRequest) {
throw request.getAttribute("filter.error") as RuntimeException
}
}