File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed
Utils/azuretools-core/src/com/microsoft/azuretools Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -176,8 +176,6 @@ public AuthResult signIn(@Nullable AuthResult savedAuth) throws IOException {
176
176
// Swallow the exception since some provided environments are not full featured
177
177
LOGGER .warning ("Can't get " + env .resourceManagerEndpoint () + " access token from environment " +
178
178
CommonSettings .getEnvironment ().getName ());
179
- } else {
180
- throw e ;
181
179
}
182
180
}
183
181
@@ -188,8 +186,6 @@ public AuthResult signIn(@Nullable AuthResult savedAuth) throws IOException {
188
186
// Swallow the exception since some provided environments are not full featured
189
187
LOGGER .warning ("Can't get " + env .graphEndpoint () + " access token from environment " +
190
188
CommonSettings .getEnvironment ().getName ());
191
- } else {
192
- throw e ;
193
189
}
194
190
}
195
191
Original file line number Diff line number Diff line change 39
39
import com .microsoft .azuretools .utils .AzureRegisterProviderNamespaces ;
40
40
import com .microsoft .azuretools .utils .Pair ;
41
41
import com .microsoft .rest .credentials .ServiceClientCredentials ;
42
+ import rx .Observable ;
42
43
43
44
import java .io .IOException ;
45
+ import java .util .Collections ;
44
46
import java .util .LinkedList ;
45
47
import java .util .List ;
46
48
import java .util .logging .Logger ;
@@ -113,12 +115,30 @@ public Settings getSettings() {
113
115
}
114
116
115
117
public static List <Subscription > getSubscriptions (String tid ) throws IOException {
116
- List <Subscription > sl = authTid (tid ).subscriptions ().list ();
118
+ List <Subscription > sl = authTid (tid ).subscriptions ().listAsync ()
119
+ .onErrorResumeNext (err -> {
120
+ LOGGER .warning (err .getMessage ());
121
+
122
+ return Observable .empty ();
123
+ })
124
+ .toList ()
125
+ .toBlocking ()
126
+ .singleOrDefault (Collections .emptyList ());
127
+
117
128
return sl ;
118
129
}
119
130
120
131
public static List <Tenant > getTenants (String tid ) throws IOException {
121
- List <Tenant > tl = authTid (tid ).tenants ().list ();
132
+ List <Tenant > tl = authTid (tid ).tenants ().listAsync ()
133
+ .onErrorResumeNext (err -> {
134
+ LOGGER .warning (err .getMessage ());
135
+
136
+ return Observable .empty ();
137
+ })
138
+ .toList ()
139
+ .toBlocking ()
140
+ .singleOrDefault (Collections .emptyList ());
141
+
122
142
return tl ;
123
143
}
124
144
You can’t perform that action at this time.
0 commit comments