@@ -1584,7 +1584,10 @@ private static void performBuild(BuildConfiguration config, Function<BuildConfig
1584
1584
try {
1585
1585
build (config , nativeImageProvider );
1586
1586
} catch (NativeImageError e ) {
1587
- NativeImage .show (System .err ::println , "Error: " + e .getMessage ());
1587
+ String message = e .getMessage ();
1588
+ if (message != null ) {
1589
+ NativeImage .show (System .err ::println , "Error: " + message );
1590
+ }
1588
1591
Throwable cause = e .getCause ();
1589
1592
while (cause != null ) {
1590
1593
NativeImage .show (System .err ::println , "Caused by: " + cause );
@@ -1620,8 +1623,7 @@ protected static void build(BuildConfiguration config, Function<BuildConfigurati
1620
1623
break ;
1621
1624
case BUILDER_ERROR :
1622
1625
/* Exit, builder has handled error reporting. */
1623
- System .exit (exitStatusCode );
1624
- break ;
1626
+ throw showError (null , null , exitStatusCode );
1625
1627
case FALLBACK_IMAGE :
1626
1628
nativeImage .showMessage ("Generating fallback image..." );
1627
1629
build (new FallbackBuildConfiguration (nativeImage ), nativeImageProvider );
@@ -1632,8 +1634,7 @@ protected static void build(BuildConfiguration config, Function<BuildConfigurati
1632
1634
break ;
1633
1635
case OUT_OF_MEMORY :
1634
1636
nativeImage .showOutOfMemoryWarning ();
1635
- System .exit (exitStatusCode );
1636
- break ;
1637
+ throw showError (null , null , exitStatusCode );
1637
1638
default :
1638
1639
String message = String .format ("Image build request for '%s' (pid: %d, path: %s) failed with exit status %d" ,
1639
1640
nativeImage .imageName , nativeImage .imageBuilderPid , nativeImage .imagePath , exitStatusCode );
0 commit comments