From: Eric B. R. <eb...@tc...> - 2003-02-12 22:27:46
|
On Wednesday, February 12, 2003, at 05:09 PM,=20 kea...@na... wrote: > You're right, I was mislead by some apparently dead code in the = parser: > > =A0=A0=A0 throw new ParseException("No such directive #" + directive); > > Apparently, this now gets handled by the MacroBuilder.build(), which=20= > throws: > > =A0=A0=A0=A0=A0=A0=A0=A0 throw new BuildException ("#" + name + ": no = such Macro or=20 > Directive"); > =A0 > This should make things much simpler. > > So you could just say: > > =A0=A0=A0=A0=A0=A0=A0=A0=A0 = bc.getEvaluationExceptionHandler().evaluate(null, bc, > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 new BuildException ("#" + name + ": = no such Macro or=20 > Directive")); Well, the problem is that we have to return something that is to be put=20= into the Template to replace the unknown directive. Like, if we just want to output it as a string literal, we'd need to=20 return some kind of new StringMacro(name) from .build()... and EEH=20 doesn't really have the facility for doing that. This is the tricky=20 part. > > This would actually fail with the DefaultEEH, as it currently doesn't=20= > check for a null variable arg.=A0 Easily fixed, but better would be to=20= > create a new PropertyException, like=20 > PropertyException.NoSuchDirectiveOrMacro and throw that. Yeah, we'd need to teach DEEH about this new exception. > I could try to make these changes if you'd like. gotta figure out how to get the directive name back into the Template=20 as a String. eric > > Keats > > > -----Original Message----- > > From: Eric B. Ridge [mailto:eb...@tc...] > > Sent: Wednesday, February 12, 2003 4:36 PM > > To: kea...@na... > > Cc: la...@op...; br...@qu...; ma...@an...; > > web...@li... > > Subject: Re: [Webmacro-devel] Handling Dreamweaver stuff > > > > > > On Wednesday, February 12, 2003, at 04:01=A0 PM, > > kea...@na... wrote: > > > > > I think using the EEH would be great, but it does present some > > > challenges as Eric has pointed out.=A0 The unknown directive > > exceptions > > > are thrown by the parser.=A0 The parser does have a reference to = the > > > broker, so it should be able to get the EEH and pass > > exceptions back > > > to it. > > > > Technically, it's a BuildException, not a ParseException. > > > > > > > > Unfortunately the EEH interface was designed to handle evaluation > > > exceptions (hence the name).=A0 To handle parse exceptions we = would > > > probably want a new method in the interface (like "parse()").=A0 = This > > > would require a change in all existing EEH implementations.=A0 > >=A0 Probably > > > not a huge problem, but something to consider.=A0 > > > > > > Also the name wouldn't be quite appropriate if we expand > > the scope of > > > this.=A0 It should probably be just ExceptionHandler or > > > WMExceptionHandler.=A0 Maybe an o.w.ExceptionHandler interface = could > > > extend EvaluationExceptionHandler and add the new method.=A0 > > Then if you > > > configure an ExceptionHandler, it would automatically set > > the EEH as > > > well.=A0 This should preserve backwards compatability. > > > > I don't think we'll need to change the interface for EEH.=A0 But we > > could/should change the name... > > > > > > > > In any case, someone would need to tweek the parser -- and > > I know of > > > only two candidates ... > > > > The parser won't need to be touched.=A0 I don't believe. > > > > > > > > Keats > > > > > > > -----Original Message----- > > > > From: Eric B. Ridge [mailto:eb...@tc...] > > > > Sent: Tuesday, February 11, 2003 8:05 PM > > > > To: la...@op... > > > > Cc: Brian Goetz; ma...@an...; > > > > web...@li... > > > > Subject: Re: [Webmacro-devel] Handling Dreamweaver stuff > > > > > > > > > > > > On Tuesday, February 11, 2003, at 04:12=A0 PM, Lane Sharman = wrote: > > > > > > > > > ebr: > > > > > > > > > > Can you make a stab at modifying eeh so that we can try > > this out? > > > > > > > > I can, yes... when I find the time. > > > > > > > > The issue here is that EEH is used as a "runtime" thing, not a > > > > "buildtime" thing, so I'm not sure how it will interact with the > > > > BuildContext (if it all). > > > > > > > > Assuming I can work that out, I guess we want: > > > > =A0=A0=A0=A0=A0 CrankyEEH to *always* throw on #unknown = directives > > > > =A0=A0=A0=A0=A0 DefaultEEH to *always* pass #unknown directives = to the > > > > stream as > > > > string literals > > > >=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 MarcEEH to do whatever Marc wants, = to be > > written by him.=A0 > > > :) > > > > > > > > eric > > > > > > > > > > > > > > -l > > > > > > > > > > Eric B. Ridge wrote: > > > > > > > > > >> On Tuesday, February 11, 2003, at 03:35=A0 PM, Brian Goetz=20 > wrote: > > > > >> > > > > >>>> This problem is elegantly solved thru the introduction of a > > > > >>>> property, > > > > >>>> StrictDirectiveTypeChecking. Invariably, there will be > > > > times when > > > > >>>> you > > > > >>>> cannot "include as text" a DW file because you will > > want to add > > > > >>>> some WM > > > > >>>> var reference to it! > > > > >>> > > > > >>> > > > > >>> I'd rather see "strict directive checking" rolled in with > > > > other forms > > > > >>> of strict checking (like the Cranky EEH), rather than > > have seven > > > > >>> different > > > > >>> things a user would have to do to get strict checking. > > > > >> > > > > >> > > > > >> Better yet (maybe), roll this thing through EEH... if > > that's even > > > > >> possible. > > > > >> > > > > >> eric > > > > >> > > > > >> > > > > >> > > > > >> ------------------------------------------------------- > > > > >> This SF.NET email is sponsored by: > > > > >> SourceForge Enterprise Edition + IBM + LinuxWorld =3D > > > > Something 2 See! > > > > >> http://www.vasoftware.com > > > > >> _______________________________________________ > > > > >> Webmacro-devel mailing list > > > > >> Web...@li... > > > > >> https://lists.sourceforge.net/lists/listinfo/webmacro-devel > > > > >> > > > > > > > > > > -- > > > > > Lane Sharman > > > > > http://opendoors.com Conga, GoodTimes and Application > > > > Hosting Services > > > > > http://opendoors.com/lane.pdf BIO > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > > This SF.NET email is sponsored by: > > > > > SourceForge Enterprise Edition + IBM + LinuxWorld =3D = Something 2 > > > See! > > > > > http://www.vasoftware.com > > > > > _______________________________________________ > > > > > Webmacro-devel mailing list > > > > > Web...@li... > > > > > https://lists.sourceforge.net/lists/listinfo/webmacro-devel > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This SF.NET email is sponsored by: > > > > SourceForge Enterprise Edition + IBM + LinuxWorld =3D > > Something 2 See! > > > > http://www.vasoftware.com > > > > _______________________________________________ > > > > Webmacro-devel mailing list > > > > Web...@li... > > > > https://lists.sourceforge.net/lists/listinfo/webmacro-devel > > > > > > > > > > |