Skip to content

Commit 1af37ee

Browse files
Merge pull request #17 from CommonWorkflowScheduler/restlogging
Log error if Rest Endpoint not found
2 parents 618d120 + c01c7a2 commit 1af37ee

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package cws.k8s.scheduler.config;
2+
3+
import org.springframework.core.Ordered;
4+
import org.springframework.core.annotation.Order;
5+
import org.springframework.http.HttpHeaders;
6+
import org.springframework.http.HttpStatusCode;
7+
import org.springframework.http.ResponseEntity;
8+
import org.springframework.web.bind.annotation.ControllerAdvice;
9+
import org.springframework.web.context.request.WebRequest;
10+
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
11+
import org.springframework.web.servlet.resource.NoResourceFoundException;
12+
13+
@Order(Ordered.HIGHEST_PRECEDENCE)
14+
@ControllerAdvice
15+
public class RestExceptionHandler extends ResponseEntityExceptionHandler {
16+
17+
@Override
18+
protected ResponseEntity<Object> handleNoResourceFoundException(
19+
NoResourceFoundException ex, HttpHeaders headers, HttpStatusCode status, WebRequest request ) {
20+
logger.error("No resource found: " + request.getDescription(false));
21+
return super.handleNoResourceFoundException( ex, headers, status, request );
22+
}
23+
24+
25+
}

0 commit comments

Comments
 (0)