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

Method __str__

tools/inspector_protocol/jinja2/exceptions.py:95–116  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

nothing calls this directly

Calls 3

splitlinesMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected