In this issue:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=13919
Joe suggests that more information should be included in the failure
message. Rather than special-casing every possible failure cause,
perhaps it would be better to just print out the underlying exception?
When an asadmin command fails and throws CommandException, the asadmin
framework prints out the message from the exception as the reason for the
failure. If I change it to also print out the "cause" embedded in that
exception, then I get this for the case that Joe describes:
CLI802 Synchronization failed for directory config
Command failed with exception: org.glassfish.api.admin.CommandException: No
remote server named XXX. Is that the correct host name?
Yes, the CommandException embeds another CommandException with a more detailed
message. And *that* exception embeds the original UnknownHostException.
Here's the options I'm considering to address this. What do people think?
1. Fix *only* the synchronization code to include the message from the
underlying exception in the failure message, e.g.,
CLI802 Synchronization failed for directory config, caused by:
org.glassfish.api.admin.CommandException: No remote server named XXX. Is that
the correct host name?
(Maybe you can't tell, but that's all on one line above.)
2. Change the asadmin framework to always include information about the
cause of a failure as in my example above:
CLI802 Synchronization failed for directory config
Command failed with exception: org.glassfish.api.admin.CommandException: No
remote server named XXX. Is that the correct host name?
(That's two lines above.)
My only concern with this is that we may start getting additional exception
messages that are not relevant or not useful to the user.
2a. A variant of the above where the additional information is only printed
if --terse is not set.
3. Like #2, but run down the entire chain of exceptions, printing each one,
e.g.,
CLI802 Synchronization failed for directory config
Caused by: org.glassfish.api.admin.CommandException: No remote server named
XXX. Is that the correct host name?
Caused by: java.net.UnknownHostException: XXX
(That's three lines.)
This may be way too verbose and cryptic for regular users.
Comments?