Merge pull request #12474 from amitiw4u/BAEL-5297_ExceptionHandling
Bael 5297 exception handling
This commit is contained in:
+1
-1
@@ -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");
|
||||
}
|
||||
|
||||
+1
-4
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-2
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user