How to report exception cause in AS7 consoles?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to report exception cause in AS7 consoles?

Jeff Mesnil
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.

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?

thanks,
jeff


[1] https://issues.jboss.org/browse/AS7-1735

--
Jeff Mesnil
JBoss, a division of Red Hat
http://jmesnil.net/
_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to report exception cause in AS7 consoles?

Alexey Loubyansky
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
>
_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to report exception cause in AS7 consoles?

jtgreene
Administrator
On 3/21/12 8:21 AM, Alexey Loubyansky wrote:

> 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".

Another option is that you can add extra validation to the Add*
operations before you even get to the point of starting the service.

--
Jason T. Greene
JBoss AS Lead / EAP Platform Architect
JBoss, a division of Red Hat
_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev