Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadError exception fails to mention the file generating the error. #261

Closed
ssbarnea opened this issue May 2, 2020 · 0 comments
Closed

Comments

@ssbarnea
Copy link
Sponsor Contributor

ssbarnea commented May 2, 2020

While the error causing the exception seems to be caused by #218 what makes it much worse is the it produces an output which makes impossible to identify the filename causing the problem:

$ yamllint -f parsable .                                                                                                                                                  Traceback (most recent call last):
File "/Users/ssbarnea/.pyenv/versions/3.7.6/bin/yamllint", line 10, in <module>
sys.exit(run())
File "/Users/ssbarnea/.pyenv/versions/3.7.6/lib/python3.7/site-packages/yamllint/cli.py", line 185, in run
no_warn=args.no_warnings)
File "/Users/ssbarnea/.pyenv/versions/3.7.6/lib/python3.7/site-packages/yamllint/cli.py", line 91, in show_problems
for problem in problems:
File "/Users/ssbarnea/.pyenv/versions/3.7.6/lib/python3.7/site-packages/yamllint/linter.py", line 198, in _run
syntax_error = get_syntax_error(buffer)
File "/Users/ssbarnea/.pyenv/versions/3.7.6/lib/python3.7/site-packages/yamllint/linter.py", line 179, in get_syntax_error
list(yaml.parse(buffer, Loader=yaml.BaseLoader))
File "/Users/ssbarnea/.pyenv/versions/3.7.6/lib/python3.7/site-packages/yaml/__init__.py", line 73, in parse
loader = Loader(stream)
File "/Users/ssbarnea/.pyenv/versions/3.7.6/lib/python3.7/site-packages/yaml/loader.py", line 14, in __init__
Reader.__init__(self, stream)
File "/Users/ssbarnea/.pyenv/versions/3.7.6/lib/python3.7/site-packages/yaml/reader.py", line 74, in __init__
self.check_printable(stream)
File "/Users/ssbarnea/.pyenv/versions/3.7.6/lib/python3.7/site-packages/yaml/reader.py", line 144, in check_printable
'unicode', "special characters are not allowed")
yaml.reader.ReaderError: unacceptable character #x001b: special characters are not allowed
in "<unicode string>", position 60
FAIL: 1

At minimum, the filename must be mentioned.

ssbarnea added a commit to ssbarnea/yamllint that referenced this issue May 2, 2020
Avoids confusing tracebacks when ReadErrors exceptions are raised
from the yaml reader.

Now we do print the filename that failed to load and stop processing
in order to avoid additional exceptions.

Also adds tests to prevent future regressions.

Fixes: adrienverge#261
ssbarnea added a commit to ssbarnea/yamllint that referenced this issue May 2, 2020
Avoids confusing tracebacks when ReadErrors exceptions are raised
from the yaml reader.

Now we do print the filename that failed to load and stop processing
in order to avoid additional exceptions.

Also adds tests to prevent future regressions.

Fixes: adrienverge#261
ssbarnea added a commit to ssbarnea/yamllint that referenced this issue May 2, 2020
Avoids confusing tracebacks when ReadErrors exceptions are raised
from the yaml reader.

Now we do print the filename that failed to load and stop processing
in order to avoid additional exceptions.

Also adds tests to prevent future regressions.

Fixes: adrienverge#261
ssbarnea added a commit to ssbarnea/yamllint that referenced this issue May 2, 2020
Avoids confusing tracebacks when ReadErrors exceptions are raised
from the yaml reader.

Now we do print the filename that failed to load and stop processing
in order to avoid additional exceptions.

Also adds tests to prevent future regressions.

Fixes: adrienverge#261
ssbarnea added a commit to ssbarnea/yamllint that referenced this issue May 3, 2020
Avoids confusing tracebacks when ReadErrors exceptions are raised
from the yaml reader.

Now we do print the filename that failed to load and stop processing
in order to avoid additional exceptions.

Also adds tests to prevent future regressions.

Fixes: adrienverge#261
ssbarnea added a commit to ssbarnea/yamllint that referenced this issue Oct 9, 2020
Avoids confusing tracebacks when ReadErrors exceptions are raised
from the yaml reader.

Now we do print the filename that failed to load and stop processing
in order to avoid additional exceptions.

Also adds tests to prevent future regressions.

Fixes: adrienverge#261
@ssbarnea ssbarnea closed this as completed Mar 2, 2023
ssbarnea added a commit to ssbarnea/yamllint that referenced this issue Mar 16, 2023
Avoids confusing tracebacks when ReadErrors exceptions are raised
from the yaml reader.

Now we do print the filename that failed to load and stop processing
in order to avoid additional exceptions.

Also adds tests to prevent future regressions.

Fixes: adrienverge#261
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant