Skip to content

Commit 827c800

Browse files
CSTACKEX-158: validating for 404 with error-code check
1 parent 312c13f commit 827c800

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/utils/OntapStorageUtils.java‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.cloud.exception.InvalidParameterValueException;
2323
import com.cloud.utils.StringUtils;
2424
import com.cloud.utils.exception.CloudRuntimeException;
25+
import feign.FeignException;
2526
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
2627
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
2728
import org.apache.cloudstack.storage.feign.model.Lun;
@@ -247,15 +248,24 @@ public static boolean isOntapObjectNotFoundError(Throwable error) {
247248
if (error == null) {
248249
return false;
249250
}
251+
if(error instanceof FeignException) {
252+
FeignException feignException = (FeignException) error;
253+
if (feignException.status() == 404) {
254+
return true;
255+
}
256+
}
250257
String message = error.getMessage();
251258
if (message != null) {
252259
String lower = message.toLowerCase();
253260
if (lower.contains("404") || lower.contains("not found") || lower.contains("does not exist")
254261
|| lower.contains("entry doesn't exist")) {
255262
return true;
256263
}
264+
} else {
265+
logger.warn("Error message is null for exception: {}", error.getClass().getName());
266+
return false;
257267
}
258-
return isOntapObjectNotFoundError(error.getCause());
268+
return false;
259269
}
260270

261271
}

0 commit comments

Comments
 (0)