fix: 添加错误URL异常抛出

This commit is contained in:
ClovertaTheTrilobita 2025-04-11 15:19:55 +08:00
parent 5176183445
commit 764e9ecb1e
2 changed files with 18 additions and 0 deletions

View file

@ -0,0 +1,14 @@
package com.cloverta.webapi.controller;
import com.cloverta.webapi.restservice.Error;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class CustomErrorController implements ErrorController {
@RequestMapping("/error")
public Error error() {
return new Error("ERROR", "Something went wrong... I hope it wasn't my fault.");
}
}

View file

@ -0,0 +1,4 @@
package com.cloverta.webapi.restservice;
public record Error(String status, String message) {
}