You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Mark Lundquist <ml...@wrinkledog.com> on 2005/07/29 21:30:18 UTC

exceptions within forms template macros

Hi,

I've switched over to using the jx-macros.xml implementation of the 
forms template language (i.e. not using FormsTemplateTransformer 
anymore).  One thing that is really troublesome is that if an exception 
gets thrown out of something called by the macros (typically class 
JXMacrosHelper), JXTG reports the error with line+column corresponding 
to the outermost macro, i.e. the <ft:form-template>.  Needless to say 
that's not super-helpful.

I'm sort of stuck on 2.1.6 right now, so maybe this has been fixed 
since then...?  If not, has anybody else noticed this?  Sylvain... any 
way to fix?

thx-a-lot,
Mark


Re: exceptions within forms template macros

Posted by Sylvain Wallez <sy...@apache.org>.
Mark Lundquist wrote:

> Hi,
>
> I've switched over to using the jx-macros.xml implementation of the 
> forms template language (i.e. not using FormsTemplateTransformer 
> anymore).  One thing that is really troublesome is that if an 
> exception gets thrown out of something called by the macros (typically 
> class JXMacrosHelper), JXTG reports the error with line+column 
> corresponding to the outermost macro, i.e. the <ft:form-template>.  
> Needless to say that's not super-helpful.
>
> I'm sort of stuck on 2.1.6 right now, so maybe this has been fixed 
> since then...?  If not, has anybody else noticed this?  Sylvain... any 
> way to fix?


The problem is that the current exception handling system can only 
report *one* location. Which one should be reported? The deepmost, or 
the topmost?

What we actually want is a location stack. And know what? Just right now 
(yeah, I know, it's sat. morning...) I'm working on adding "Cocoon stack 
traces" we talked about a long time ago, as this became really obvious 
after the changes I made to the CForms parsing stuff [1].

The idea is based on a Location class and a Locatable interface. A 
location holds an URI, a line and column number. Locatable objects know 
their location. These are sitemap statements, form widgets and bindings, 
jxtemplate instructions, etc...

When a problem occurs in a locatable object, it attaches its location to 
the exception it throws (ProcessingException also implements Locatable). 
We then just have to traverse the exception chain to get a Cocoon 
stacktrace along with the Java stacktrace.

Stay tuned.

Sylvain

[1] http://svn.apache.org/viewcvs.cgi?rev=226343&view=rev

-- 
Sylvain Wallez                        Anyware Technologies
http://people.apache.org/~sylvain     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director