Merge pull request #12474 from amitiw4u/BAEL-5297_ExceptionHandling

Bael 5297 exception handling
This commit is contained in:
Loredana Crusoveanu
2022-08-27 21:10:14 +03:00
committed by GitHub
22 changed files with 469 additions and 7 deletions
@@ -13,7 +13,7 @@ public class CustomErrorDecoder implements ErrorDecoder {
case 400:
return new BadRequestException();
case 404:
return new NotFoundException();
return new NotFoundException("Not found !!!");
default:
return new Exception("Generic error");
}
@@ -2,9 +2,6 @@ package com.baeldung.cloud.openfeign.exception;
public class NotFoundException extends Exception {
public NotFoundException() {
}
public NotFoundException(String message) {
super(message);
}
@@ -15,7 +12,7 @@ public class NotFoundException extends Exception {
@Override
public String toString() {
return "NotFoundException: "+getMessage();
return "NotFoundException: " + getMessage();
}
}
@@ -14,7 +14,7 @@ public class UploadService {
@Autowired
private UploadClient client;
public boolean uploadFileWithManualClient(MultipartFile file) {
UploadResource fileUploadResource = Feign.builder().encoder(new SpringFormEncoder())
.target(UploadResource.class, HTTP_FILE_UPLOAD_URL);
@@ -29,5 +29,4 @@ public class UploadService {
public String uploadFileError(MultipartFile file) {
return client.fileUpload(file);
}
}