Skip to content
Snippets Groups Projects
Commit c77dd4de authored by Lukasz Lopatowski's avatar Lukasz Lopatowski
Browse files

Added error log

parent c96b471f
No related branches found
No related tags found
1 merge request!273Release 1.8.0 update
Pipeline #94226 passed
......@@ -25,7 +25,7 @@ public class WebhookEventDto {
@Pattern(regexp = "^(Authorization|X-.*)?$", message = "Authorization header must be either 'Authorization' or start with 'X-'")
private String authorizationHeader;
public WebhookEventDto (Long id, String name, String targetUrl, WebhookEventType eventType){
public WebhookEventDto(Long id, String name, String targetUrl, WebhookEventType eventType) {
this.id = id;
this.name = name;
this.targetUrl = targetUrl;
......
package net.geant.nmaas.portal.api.market;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.MethodArgumentNotValidException;
......@@ -10,6 +11,7 @@ import java.util.HashMap;
import java.util.Map;
@ControllerAdvice(assignableTypes = WebhookEventController.class)
@Slf4j
public class WebhookEventAdvice {
@ExceptionHandler(MethodArgumentNotValidException.class)
......@@ -19,6 +21,8 @@ public class WebhookEventAdvice {
ex.getBindingResult().getFieldErrors().forEach(error ->
errors.put(error.getField(), error.getDefaultMessage()));
log.warn("Responding with 400 with errors: {}", errors);
return new ResponseEntity<>(errors, HttpStatus.BAD_REQUEST);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment