Skip to content

Commit

Permalink
Swallow exception while resolve func path, fixes #6569
Browse files Browse the repository at this point in the history
  • Loading branch information
Flanker32 committed Apr 29, 2022
1 parent 558e659 commit 3eb3f70
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.microsoft.azure.toolkit.lib.common.action.AzureActionManager;
import com.microsoft.azure.toolkit.lib.common.messager.AzureMessager;
import com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import javax.annotation.Nonnull;
Expand All @@ -46,6 +47,7 @@
import java.util.Set;
import java.util.stream.Collectors;

@Slf4j
public class FunctionCoreToolsCombobox extends AzureComboBox<String> {
private static final String AZURE_TOOLKIT_FUNCTION_CORE_TOOLS_HISTORY = "azure_toolkit.function.core.tools.history";
private static final String OPEN_AZURE_SETTINGS = "Open Azure Settings";
Expand Down Expand Up @@ -112,7 +114,13 @@ private String getDefaultFuncPath() {
protected List<? extends String> loadItems() throws Exception {
final List<String> result = new ArrayList<>();
result.addAll(loadHistory());
result.addAll(FunctionCliResolver.resolve());
try {
result.addAll(FunctionCliResolver.resolve());
} catch (RuntimeException e) {
// swallow exception while resolve function path
// todo @hanli: handle the exception in lib
log.warn(e.getMessage(), e);
}
result.add(getDefaultFuncPath());
result.add(includeSettings ? OPEN_AZURE_SETTINGS : null);
return result.stream().filter(Objects::nonNull).distinct().sorted().collect(Collectors.toList());
Expand Down

0 comments on commit 3eb3f70

Please sign in to comment.