forked from loafle/openapi-generator-original
[all] Better error message for missing libraries (#6856)
This commit is contained in:
@@ -3362,8 +3362,17 @@ public class DefaultCodegen {
|
||||
* @param library Library template
|
||||
*/
|
||||
public void setLibrary(String library) {
|
||||
if (library != null && !supportedLibraries.containsKey(library))
|
||||
throw new RuntimeException("unknown library: " + library);
|
||||
if (library != null && !supportedLibraries.containsKey(library)) {
|
||||
StringBuilder sb = new StringBuilder("Unknown library: " + library + "\nAvailable libraries:");
|
||||
if(supportedLibraries.size() == 0) {
|
||||
sb.append("\n ").append("NONE");
|
||||
} else {
|
||||
for (String lib : supportedLibraries.keySet()) {
|
||||
sb.append("\n ").append(lib);
|
||||
}
|
||||
}
|
||||
throw new RuntimeException(sb.toString());
|
||||
}
|
||||
this.library = library;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user