mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Catch all exceptions in __init__
This commit is contained in:
parent
c421956cd9
commit
698686e1d4
2 changed files with 17 additions and 15 deletions
|
|
@ -20,7 +20,9 @@ class Pelican(object):
|
||||||
"""
|
"""
|
||||||
self.path = path or settings['PATH']
|
self.path = path or settings['PATH']
|
||||||
if not self.path:
|
if not self.path:
|
||||||
raise Exception('you need to specify a path to search the docs on !')
|
raise Exception('you need to specify a path containing the content'
|
||||||
|
' (see pelican --help for more information)')
|
||||||
|
|
||||||
if self.path.endswith('/'):
|
if self.path.endswith('/'):
|
||||||
self.path = path[:-1]
|
self.path = path[:-1]
|
||||||
|
|
||||||
|
|
@ -132,20 +134,19 @@ def main():
|
||||||
module = __import__(module)
|
module = __import__(module)
|
||||||
cls = getattr(module, cls_name)
|
cls = getattr(module, cls_name)
|
||||||
|
|
||||||
pelican = cls(settings, args.path, args.theme, args.output, markup, args.keep)
|
try:
|
||||||
|
pelican = cls(settings, args.path, args.theme, args.output, markup, args.keep)
|
||||||
if args.autoreload:
|
if args.autoreload:
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
if files_changed(pelican.path, pelican.markup):
|
if files_changed(pelican.path, pelican.markup):
|
||||||
pelican.run()
|
pelican.run()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
try:
|
|
||||||
pelican.run()
|
pelican.run()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.critical(str(e))
|
log.critical(str(e))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,8 @@ def init(level=None, logger=logging.getLogger(), handler=logging.StreamHandler()
|
||||||
fmt = Formatter()
|
fmt = Formatter()
|
||||||
handler.setFormatter(fmt)
|
handler.setFormatter(fmt)
|
||||||
logger.addHandler(handler)
|
logger.addHandler(handler)
|
||||||
if level: logger.setLevel(level)
|
if level:
|
||||||
|
logger.setLevel(level)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue