Pull request #182: RED-5427 - 500 for deleting file- & dossier-attributes in a dossier template without reports

Merge in RED/redaction-report-service from bugfix/RED-5427 to master

* commit '757bebbca41d1e52970fb0cacb253c9ee4a3cc72':
  RED-5427 - 500 for deleting file- & dossier-attributes in a dossier template without reports
This commit is contained in:
Corina Olariu 2022-10-20 12:48:26 +02:00
commit 1a010da283

View File

@ -0,0 +1,28 @@
package com.iqser.red.service.redaction.report.v1.server.controller;
import com.amazonaws.services.kms.model.NotFoundException;
import com.iqser.red.commons.spring.ErrorMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.time.OffsetDateTime;
@Slf4j
@RestControllerAdvice
public class ControllerAdvice {
/* error handling */
@ResponseBody
@ResponseStatus(value = HttpStatus.NOT_FOUND)
@ExceptionHandler(value = NotFoundException.class)
public ErrorMessage handleFileNotFoundException(NotFoundException e) {
log.error(e.getMessage(), e);
return new ErrorMessage(OffsetDateTime.now(), e.getMessage());
}
}