Hi devs,
I see that in several pages we have a use the following:
{{error}}
$error.message
{{/error}}
Where error is an Exception returned by a script service.
This is done in the Scheduler, in the Extension Manager and in the my new IRC Bot
application.
The problem is that this will only show the message but not the full stack trace which
contains the real problem…
So here's what I propose:
1) Create an internal helper WrappingTextBlockGenerator.generate() class (I'd locate
it in the Macro Transformation module for lack of a better place, see point 4 below) and
method which returns the XDOM Blocks to do this. Namely two divs with the proper
"class" set.
2) Introduce a VelocityTool to help deal with Exceptions. I propose to make ExceptionUtils
from commons-lang available as a Velocity Tool:
http://commons.apache.org/lang/api/org/apache/commons/lang3/exception/Excep…
3) Modify the Message Macro to support the feature of displaying only the first line of
text and hiding subsequent lines and when the user clicks on the text, the rest unrolls. I
propose to do this by introducing a new "format" parameter that you would use
like this: {{info|warning|error
format="compact|normal"}}….{{/info|warning|error}}. By default format would be
"normal" which means everything displayed. This feature would use
WrappingTextBlockGenerator.generate for the implementation.
4) Update MacroTransformation.generateError() to use WrappingTextBlockGenerator.generate
5) Modify Scheduler, Extension Manager, IRC Bot application to use this new feature.
For example for the IRC Bot application:
#set ($error = $botManager.getLastError())
#if ("$!error" != "")
{{error format="compact"}}
$error.message
$exceptiontool.getMessage($error)
{{/error}}
#end
WWDYT?
Thanks
-Vincent