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