Changeset 9334cb112a013fff62043c4faf833ddbf6f7c17b


Ignore:
Timestamp:
30.07.2013 00:12:40 (8 years ago)
Author:
Stanislaw Klekot <dozzie@…>
Branches:
b66903eafbcb1d49112014abc82c8bf683413db0
Children:
08b2d0dafb742d94ce8944c79e765ed244d26a21
Parents:
d07daf77017d09ba3fc30d8f9a74fda6b355c25b
git-author:
Stanislaw Klekot <dozzie@…> (30.07.2013 00:12:40)
git-committer:
Stanislaw Klekot <dozzie@…> (30.07.2013 00:12:40)
Message:

Added defending against big errors in resolving macros.

Now it won't blow up whole application.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dashwiki/wiki/views.py

    rd07daf r9334cb  
    107107  # }}} 
    108108 
    109   return resolve_macros(tree, load_macro) 
     109  try: 
     110    return resolve_macros(tree, load_macro) 
     111  except Exception, e: 
     112    e_type    = e.__class__.__name__ 
     113    e_module  = e.__class__.__module__ 
     114    e_message = str(e) 
     115    e_trace   = traceback.format_exc() 
     116    logger.warn(log( 
     117      'error when resolving macros', 
     118      ('page_name',  page_name), 
     119      exception = { 
     120        'type': '%s.%s' % (e_module, e_type), 
     121        'message': e_message, 
     122        'traceback': e_trace, 
     123      }, 
     124    )) 
     125    return { 
     126      'document': { 
     127        'text_paragraph': error( 
     128          'Error when resolving macros on this page: ', str(e) 
     129        ), 
     130      } 
     131    } 
    110132 
    111133# }}} 
Note: See TracChangeset for help on using the changeset viewer.