Vincent Massol wrote:
Hi,
Just to let you know that I have started implementing error handling
in the new rendering. Right now my idea is to wrap macro errors (macro
not found, macro execution error) in an ErrorBlock so that renderers
can decide to display them as they want.
Something like the following (note: I think I need to add another <!--
errordescription:(description)--> comment for putting error
description (like the staktrace) in addition to the short error message.
.#-----------------------------------------------------
.input|xwiki/2.0
.# Verify behavior when macro doesn't exist
.#-----------------------------------------------------
Unknown {{unknown/}} macro
.#-----------------------------------------------------
.expect|event
.#-----------------------------------------------------
beginDocument
beginParagraph
onWord [Unknown]
onSpace
beginError: [Unknown macro: unknown]
onMacroInline [unknown] [] []
endError: [Unknown macro: unknown]
onSpace
onWord [macro]
endParagraph
endDocument
.#-----------------------------------------------------
.expect|xhtml
.#-----------------------------------------------------
<p>Unknown <!--starterror:Unknown macro: unknown--><!--
startmacro:unknown|-||-|--><!--stopmacro--><!--stoperror-->
macro</p>
If this is the expected output from the XHTML renderer then I guess the
exception won't be visible in view mode, right?
In WYSIWYG we'd have to use a placeholder different than the one used
for macros with no rendered content.
.#-----------------------------------------------------
.expect|xwiki
.#-----------------------------------------------------
Unknown {{unknown/}} macro
.#-----------------------------------------------------
.input|xhtml/1.0
.#-----------------------------------------------------
<html><p>Unknown <!--starterror:Unknown macro: unknown--><!--
startmacro:unknown|-||-|--><!--stopmacro--><!--stoperror-->
macro</p></
html>
I still haven't decided if MacroTransformation should still raise
exceptions or not. I'm also investigating how to handle other
rendering errors but my idea is also to wrap them in error blocks.
Let me know what you think and respond quickly if you don't agree with
this since I'm progressing fast on it.
Thanks
-Vincent
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs