类 ExceptionDemoController

java.lang.Object
com.elitesland.ystdms.sys.controller.ExceptionDemoController

@RestController @RequestMapping("/api/v1/demo") public class ExceptionDemoController extends Object
异常处理演示控制器 用于演示各种异常处理场景
  • 构造器详细资料

    • ExceptionDemoController

      public ExceptionDemoController()
  • 方法详细资料

    • triggerBusinessException

      @GetMapping("/business-exception") public ApiResult<String> triggerBusinessException(@RequestParam(required=false) String message)
    • triggerValidationException

      @GetMapping("/validation-exception") public ApiResult<String> triggerValidationException(@RequestParam(required=false) String value)
    • triggerNotFoundException

      @GetMapping("/not-found-exception") public ApiResult<String> triggerNotFoundException(@RequestParam @NotBlank @NotBlank String id)
    • triggerUnauthorizedException

      @GetMapping("/unauthorized-exception") public ApiResult<String> triggerUnauthorizedException(@RequestParam(defaultValue="false") Boolean unauthorized)
    • validateObject

      @PostMapping("/validate-object") public ApiResult<String> validateObject(@Valid @RequestBody @Valid ExceptionDemoController.DemoRequest request)
    • triggerCustomBusinessException

      @GetMapping("/custom-business-exception") public ApiResult<String> triggerCustomBusinessException(@RequestParam @Min(value=0L,message="\u6570\u503c\u5fc5\u987b\u5927\u4e8e\u7b49\u4e8e0") @Min(value=0L,message="\u6570\u503c\u5fc5\u987b\u5927\u4e8e\u7b49\u4e8e0") Integer value)
    • triggerRuntimeException

      @GetMapping("/runtime-exception") public ApiResult<String> triggerRuntimeException(@RequestParam(defaultValue="false") Boolean shouldThrow)