[jboss-as7-dev] How to report exception cause in AS7 consoles?

Alexey Loubyansky alexey.loubyansky at redhat.com
Wed Mar 21 09:21:36 EDT 2012


Good topic.

On 03/21/2012 11:25 AM, Jeff Mesnil wrote:
> Hi,
>
> I am working on a messaging issue[1] to add more contextual info when
> reporting messaging failure on CLI operations.
>
> In this case, a JMS queue can not been added because the user specified
> an invalid filter.
> We throw a StartException with a cause Throwable (corresponding to the
> invalid filter parsing) but the CLI console displays only the
> StartException's message 'failed to create queue' and not its cause.
>
> I have several ways to fix the issue and I am not sure which one is the
> more appropriate for AS7:
>
> 1) I can fix the code in the messaging subsystem to append the cause's
> localized message to the StartException message every time I throw one
>
> 2) In the controller code, when I report the StartException to the user,
> I append the cause's l10ned message (if there is a cause) to
> StartException.toString() message (this impacts all thrown
> StartException, not only those from messaging subsystem)
>
> 3) I update StartException.toString() to append the cause message
>
> I prefer (3) since as it is the only place where I would have to deal
> with this but I don't realize the whole implication.

 From these 3, the third one is less "evil".

> More generally, are there guidelines for reporting errors in AS7 CLI&
> Web consoles? Are stacktraces acceptable? Is it up to every subsystems
> to "prettify" their exceptions to provide all info in the message?

What do you think?

I could add a config option to print stacktraces in case of errors. 
Otherwise, perhaps, it makes sense to go through causes and compose a 
comprehensive message. That assumes messages are not duplicated, which 
is a good practice.

Thanks,
Alexey

>
> thanks,
> jeff
>
>
> [1] https://issues.jboss.org/browse/AS7-1735
>


More information about the jboss-as7-dev mailing list