|
@@ -0,0 +1,28 @@
|
|
|
|
+package com.qmth.demo.api.controller;
|
|
|
|
+
|
|
|
|
+import com.qmth.boot.api.annotation.Aac;
|
|
|
|
+import com.qmth.boot.api.annotation.BOOL;
|
|
|
|
+import com.qmth.boot.api.constant.ApiConstant;
|
|
|
|
+import com.qmth.boot.core.exception.ReentrantException;
|
|
|
|
+import com.qmth.boot.core.exception.StatusException;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/exception")
|
|
|
|
+@Aac(strict = BOOL.FALSE, auth = BOOL.FALSE)
|
|
|
|
+public class ExceptionController {
|
|
|
|
+
|
|
|
|
+ @RequestMapping("/status")
|
|
|
|
+ public Object status(@RequestParam(required = false) Integer code, @RequestParam(required = false) String name,
|
|
|
|
+ @RequestParam String message) {
|
|
|
|
+ throw new StatusException(code, name, message, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping("/reentrant")
|
|
|
|
+ public Object reentrant(@RequestParam(required = false) String message) {
|
|
|
|
+ throw new ReentrantException(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|