#230 improved TemplateHandler failure-handling

Needs_Review
closed
nobody
None
5
2012-10-28
2010-07-21
No

The attached patch improve the cdk.layout.TemplateHandler loadTemplates() function to be less susceptible to exceptions.

Previously, any exception at anytime during template loading would cause all hope to be abandoned and template-loading to terminate.
With the attached improvements, file-read problems are handled on a per-template basis, so that even with a failure of one template, the others will still be loaded. (or rather: attempt to be loaded)
This also removes the (very ugly) "catch (Exception ex)" statement. One should never catch the root exception.

Discussion

  • Egon Willighagen

    Two initial comments...

    1. I suggest you look at 'git format-patch' to create patches
    2. please do not 'fix' whitespace

    The latter is important, because it makes it really hard to see what the real code changes are...

     
  • Jules Kerssemakers

    @1: aha, very useful! I'll try that from now on (still learning :-) ).
    @2: I came across some mentions of "leave whitespace alone" before, but then it was accompanied by "fix indents in their own patch to be easy on the diffs", so that's what I did.
    In any case, the whitespace fix is not very dramatic, it's for the few lines that are re-indented by the exception cleaning anyway.

    uploaded a new version that leaves whitespace alone (indenting looks ugly to me now), formatted with format-patch

     
  • Egon Willighagen

    Jules, make sure you patch against master... the attached patch had other patches that are not available in master, which made your patch not apply.

    I now manually applied your patch, in your name, but it did change the date.

     

Log in to post a comment.