o Fixed missing error reporting for bad settings

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@787084 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-06-21 20:10:52 +00:00
parent d90f22f338
commit 5672ae45e8
2 changed files with 24 additions and 4 deletions

View File

@ -167,4 +167,24 @@ public final class CLIReportingUtils
return properties; return properties;
} }
public static void showError( String message, Exception e, boolean showStackTrace )
{
System.err.println( message );
if ( showStackTrace )
{
e.printStackTrace();
}
else
{
System.err.println( e.getMessage() );
for ( Throwable cause = e.getCause(); cause != null; cause = cause.getCause() )
{
System.err.print( "Caused by: " );
System.err.println( cause.getMessage() );
}
}
}
} }

View File

@ -131,14 +131,14 @@ public class MavenCli
if ( cvr.isUserSettingsFilePresent() && !cvr.isUserSettingsFileParses() ) if ( cvr.isUserSettingsFilePresent() && !cvr.isUserSettingsFileParses() )
{ {
//TODO: CLIReportingUtils.showError( "Error reading user settings: ", cvr.getUserSettingsException(), showErrors ); CLIReportingUtils.showError( "Error reading user settings: ", cvr.getUserSettingsException(), showErrors );
return 1; return 1;
} }
if ( cvr.isGlobalSettingsFilePresent() && !cvr.isGlobalSettingsFileParses() ) if ( cvr.isGlobalSettingsFilePresent() && !cvr.isGlobalSettingsFileParses() )
{ {
//TODO: CLIReportingUtils.showError( "Error reading global settings: ", cvr.getGlobalSettingsException(), showErrors ); CLIReportingUtils.showError( "Error reading global settings: ", cvr.getGlobalSettingsException(), showErrors );
return 1; return 1;
} }
@ -159,7 +159,7 @@ public class MavenCli
} }
catch ( MavenEmbedderException e ) catch ( MavenEmbedderException e )
{ {
//TODO: CLIReportingUtils.showError( "Unable to start the embedder: ", e, showErrors ); CLIReportingUtils.showError( "Unable to start the embedder: ", e, showErrors );
return 1; return 1;
} }