Skip to content

Commit 3c95223

Browse files
committed
Improve error messages
1 parent c81f964 commit 3c95223

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

sass-embedded-host/src/main/java/de/larsgrefer/sass/embedded/connection/BundledPackageProvider.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ protected URL getPackageUrl() {
1515

1616
String resourcePath = String.format("/de/larsgrefer/sass/embedded/bundled/dart-sass-%s", dartSassPackageSuffix);
1717

18-
return this.getClass().getResource(resourcePath);
18+
URL bundledResource = this.getClass().getResource(resourcePath);
19+
20+
if (bundledResource == null) {
21+
throw new IllegalStateException("Could not find resource: " + resourcePath);
22+
}
23+
24+
return bundledResource;
1925
}
2026

2127

sass-embedded-host/src/main/java/de/larsgrefer/sass/embedded/connection/ConnectionFactory.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ public static ProcessConnection fromPackageProvider(DartSassPackageProvider dart
5555
* @throws IOException if the subprocess can not be started.
5656
*/
5757
public static ProcessConnection ofExecutable(File executable) throws IOException {
58-
if (executable == null || !executable.isFile()) {
58+
if (executable == null) {
59+
throw new IllegalArgumentException("executable must not be null");
60+
}
61+
62+
if (!executable.isFile()) {
5963
throw new IllegalArgumentException(executable + " is not a file");
6064
}
6165

0 commit comments

Comments
 (0)