Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package software.amazon.smithy.build.model;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -44,7 +45,11 @@ private ConfigLoader() {}
static SmithyBuildConfig load(Path path) {
try {
String content = IoUtils.readUtf8File(path);
return load(path.getParent(), loadWithJson(path, content).expectObjectNode());
Path baseImportPath = path.getParent();
if (baseImportPath == null) {
baseImportPath = Paths.get(".");
}
return load(baseImportPath, loadWithJson(path, content).expectObjectNode());
} catch (ModelSyntaxException e) {
throw new SmithyBuildException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,12 @@ private void printException(String[] args, Throwable throwable) {
setUseAnsiColors(false);
}

if (throwable instanceof NullPointerException) {
Colors.BOLD_RED.out("A null pointer exception occurred while running the Smithy CLI. The --stacktrace "
+ "argument can be used to get more information. Please open an issue with the Smithy team "
+ "on GitHub so this can be investigated: https://github.com/awslabs/smithy/issues");
}

Colors.BOLD_RED.out(throwable.getMessage());
if (hasArgument(args, STACKTRACE)) {
StringWriter sw = new StringWriter();
Expand Down