You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2021/02/06 20:04:00 UTC
[jira] [Updated] (MNG-7093) Construct exceptions with args to
String.format().
[ https://issues.apache.org/jira/browse/MNG-7093?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory updated MNG-7093:
---------------------------------
External issue URL: https://github.com/apache/maven/pull/441
> Construct exceptions with args to String.format().
> --------------------------------------------------
>
> Key: MNG-7093
> URL: https://issues.apache.org/jira/browse/MNG-7093
> Project: Maven
> Issue Type: New Feature
> Components: Plugin API
> Reporter: Gary D. Gregory
> Priority: Minor
>
> Construct exceptions with args to String.format() to allow for a simpler and richer way to build messages, for example, right now, in the Apache Commons release plugin, I say:
> {code:java}
> throw new MojoExecutionException("Failed to add files to SCM: " + addResult.getProviderMessage()
> + " [" + addResult.getCommandOutput() + "]");
> ...
> throw new MojoExecutionException(String.format("Failed to copy '%s' to '%s'", name, scmTargetPath), e);
> {code}
> But it would be nicer to say:
> {code:java}
> throw new MojoExecutionException("Failed to add files to SCM: %s [%s]", addResult.getProviderMessage(), addResult.getCommandOutput());
> ...
> throw new MojoExecutionException(e, "Failed to copy '%s' to '%s'", name, scmTargetPath));
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)