MCPcopy Index your code
hub / github.com/nodejs/node / TemplateSyntaxError

Class TemplateSyntaxError

tools/inspector_protocol/jinja2/exceptions.py:81–116  ·  view source on GitHub ↗

Raised to tell the user that there is a problem with the template.

Source from the content-addressed store, hash-verified

79
80@implements_to_string
81class TemplateSyntaxError(TemplateError):
82 """Raised to tell the user that there is a problem with the template."""
83
84 def __init__(self, message, lineno, name=None, filename=None):
85 TemplateError.__init__(self, message)
86 self.lineno = lineno
87 self.name = name
88 self.filename = filename
89 self.source = None
90
91 # this is set to True if the debug.translate_syntax_error
92 # function translated the syntax error into a new traceback
93 self.translated = False
94
95 def __str__(self):
96 # for translated errors we only return the message
97 if self.translated:
98 return self.message
99
100 # otherwise attach some stuff
101 location = 'line %d' % self.lineno
102 name = self.filename or self.name
103 if name:
104 location = 'File "%s", %s' % (name, location)
105 lines = [self.message, ' ' + location]
106
107 # if the source is set, add the line to the output
108 if self.source is not None:
109 try:
110 line = self.source.splitlines()[self.lineno - 1]
111 except IndexError:
112 line = None
113 if line:
114 lines.append(' ' + line.strip())
115
116 return u'\n'.join(lines)
117
118
119class TemplateAssertionError(TemplateSyntaxError):

Callers 4

compile_expressionMethod · 0.90
expectMethod · 0.90
wrapMethod · 0.90
tokeniterMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…