mirror of https://github.com/patacrep/patacrep.git
Engine for LaTeX songbooks
http://www.patacrep.com
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
11 years ago
|
#!/usr/bin/env python
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
"""Songbook exceptions and errors."""
|
||
|
|
||
|
class SongbookError(Exception):
|
||
11 years ago
|
"""Generic songbook error.
|
||
|
|
||
|
Songbook errors should inherit from this one.
|
||
|
"""
|
||
11 years ago
|
pass
|
||
|
|
||
|
class LatexCompilationError(SongbookError):
|
||
|
"""Error during LaTeX compilation."""
|
||
|
|
||
|
def __init__(self, basename):
|
||
11 years ago
|
super(LatexCompilationError, self).__init__()
|
||
11 years ago
|
self.basename = basename
|
||
|
|
||
|
def __str__(self):
|
||
11 years ago
|
return (
|
||
|
"""Error while pdfLaTeX compilation of "{basename}.tex"
|
||
|
(see {basename}.log for more information)."""
|
||
|
).format(basename=self.basename)
|
||
11 years ago
|
|
||
|
class CleaningError(SongbookError):
|
||
|
"""Error during cleaning of LaTeX auxiliary files."""
|
||
|
|
||
|
def __init__(self, filename, exception):
|
||
11 years ago
|
super(CleaningError, self).__init__()
|
||
11 years ago
|
self.filename = filename
|
||
|
self.exception = exception
|
||
|
|
||
|
def __str__(self):
|
||
11 years ago
|
return """Error while removing "{filename}": {exception}.""".format(
|
||
|
filename=self.filename,
|
||
|
exception=str(self.exception)
|
||
|
)
|