Skip to content

Commit cc321dd

Browse files
committed
Relaying provider config error
1 parent 68dfcd4 commit cc321dd

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

src/main/java/picoded/dstack/stack/ProviderConfig.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,28 @@ public CoreStack getProviderStack(String name) {
163163
System.out.println("!! providerStackMap ptr : "+providerStackMap);
164164

165165
// Initialization of stack and store into cache
166-
cache = initStack(providerConfig.getString("type"), providerConfig);
166+
try {
167+
cache = initStack(providerConfig.getString("type"), providerConfig);
168+
} catch(Exception e) {
169+
System.err.println(e.getMessage());
170+
System.err.println(e.getStackTrace());
171+
throw new RuntimeException(e);
172+
}
173+
174+
// Null safety check
175+
if( cache == null ) {
176+
System.out.println("!! initialized stack is null : "+name);
177+
throw new RuntimeException("Unexpected NULL provider stack was initialized");
178+
}
179+
180+
181+
// Save it into cache
167182
providerStackMap.put(name, cache);
168183

169184
// Lets do a GET validation, I dunno why im doing this
170185
if( providerStackMap.get(name) != cache ) {
171-
throw new RuntimeException("providerStackMap : failed GET after PUT safety test");
186+
System.out.println("!! Failed GET after PUT : "+name);
187+
throw new RuntimeException("Failed GET after PUT safety test");
172188
}
173189

174190
// Logically this should only happen ONCE !

0 commit comments

Comments
 (0)