fixed another python2.4 bug
[jinja2.git] / jinja2 / exceptions.py
1 # -*- coding: utf-8 -*-
2 """
3     jinja2.exceptions
4     ~~~~~~~~~~~~~~~~~
5
6     Jinja exceptions.
7
8     :copyright: 2008 by Armin Ronacher.
9     :license: BSD, see LICENSE for more details.
10 """
11
12
13 class TemplateError(Exception):
14     """Baseclass for all template errors."""
15
16
17 class UndefinedError(TemplateError):
18     """Raised if a template tries to operate on :class:`Undefined`."""
19
20
21 class TemplateNotFound(IOError, LookupError, TemplateError):
22     """Raised if a template does not exist."""
23
24     def __init__(self, name):
25         IOError.__init__(self, name)
26         self.name = name
27
28
29 class TemplateSyntaxError(TemplateError):
30     """Raised to tell the user that there is a problem with the template."""
31
32     def __init__(self, message, lineno, name):
33         TemplateError.__init__(self, '%s (line %s)' % (message, lineno))
34         self.message = message
35         self.lineno = lineno
36         self.name = name
37
38
39 class TemplateAssertionError(TemplateSyntaxError):
40     """Like a template syntax error, but covers cases where something in the
41     template caused an error at compile time that wasn't necessarily caused
42     by a syntax error.
43     """
44
45
46 class TemplateRuntimeError(TemplateError):
47     """A runtime error."""
48
49
50 class FilterArgumentError(Exception):
51     """This error is raised if a filter was called with inappropriate
52     arguments
53     """