Update FileUploadClientFallbackFactory.java

Changes for creating FallbackFactory
This commit is contained in:
Amitabh Tiwari 2022-07-10 05:09:50 +05:30
parent 8bd7b32499
commit 9b7f11418e
1 changed files with 18 additions and 18 deletions

View File

@ -9,22 +9,22 @@ import com.baeldung.cloud.openfeign.exception.NotFoundException;
@Component
public class FileUploadClientFallbackFactory implements FallbackFactory<FileUploadClient> {
@Override
public FileUploadClient create(Throwable cause) {
return new FileUploadClient() {
@Override
public String fileUpload(MultipartFile file) {
if (cause instanceof BadRequestException) {
return "Bad Request!!!";
}
if (cause instanceof NotFoundException) {
return "Not Found!!!";
}
if (cause instanceof Exception) {
return "Exception!!!";
}
return "Successfully Uploaded file!!!";
}
};
}
@Override
public FileUploadClient create(Throwable cause) {
return new FileUploadClient() {
@Override
public String fileUpload(MultipartFile file) {
if (cause instanceof BadRequestException) {
return "Bad Request!!!";
}
if (cause instanceof NotFoundException) {
return "Not Found!!!";
}
if (cause instanceof Exception) {
return "Exception!!!";
}
return "Successfully Uploaded file!!!";
}
};
}
}