Sherwood Botsford wrote:
> Is there a graceful way to handle a missing file?
> 
> Each species page on my website has a footer to insert a preformated
> table of current inventory.  These are dumped from my inventory
> databse. However sometimes that table doesn't exist because my page is
> called "Native Pussy Willow" and the inventory table is called
> Pussy_Willow_(Native).inc
> 
> I would like it to just ignore the missing file, or log it, but still
> create the page.
> 
> I tried
> [% TRY %]
> [% PROCESS Inventory.inc %]
> [% CATCH %]
> [% END %]
> 
> Thinking that I could just do nothing with the error, but this still fusses.
> 
> What I would like to do is log all errors to a separate file (so I
> have a list in one place of what to fix) but create as much of the
> page as possible.
> 
> What is the best way to do this?

Hi Sherwood,

Did you use that exact code? I know if the CATCH block is empty it won't work 
properly. For example the following will produce an error:
[% TRY %]
[% PROCESS xyz.htmlsdf %]
[% CATCH %][% END %]

but this will not:
[% TRY %]
[% PROCESS xyz.htmlsdf %]
[% CATCH %]
[% END %]

If the second form still gives you problems, then maybe try making your catch 
block something like:
[% CATCH %]
[% '' %]
[% END %]

-- Josh

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to