Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
badw-it
DHParser
Commits
d1bff1e5
Commit
d1bff1e5
authored
May 12, 2021
by
Eckhart Arnold
Browse files
error.py: preparation for multiple input files
parent
f5d87049
Changes
1
Hide whitespace changes
Inline
Side-by-side
DHParser/error.py
View file @
d1bff1e5
...
...
@@ -33,6 +33,18 @@ the string representations of the error objects. For example::
sys.exit(1)
else:
print("There have been warnings, but no errors.")
The central class of module DHParser's ``error`` is the ``Error``-class.
The easiest way to create an error object is by instantiating
the Error class with an error message and a source position::
>>> error = Error('Somethigs went wrong', 123)
>>> print(error)
Error (1000): Something went wrong
However, in order to report errors, usually at least a line and
column-number
"""
import
os
...
...
@@ -166,6 +178,10 @@ RECURSION_DEPTH_LIMIT_HIT = ErrorCode(10400)
class
Error
:
"""The Error class encapsulates the all information for a single
error.
"""
__slots__
=
[
'message'
,
'code'
,
'_pos'
,
'line'
,
'column'
,
'length'
,
'end_line'
,
'end_column'
,
'related'
,
'orig_pos'
,
'orig_doc'
,
'relatedUri'
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment