Improving exceptions would bring a better experience to DVC users and developers:
Move exceptions to a single module (dvc/exceptions.py), there would be only one file to import.
Pass a message to exceptions, brings flexibility and reduces boilerplate code.
Have broader exceptions, might bring meaningful boundaries to error handling -- #2965
_Any comments or suggestions are more than welcome)_
The only way I could think of dealing with this, is to _brute force_ it: going through all the exceptions, taking notes and submit a proposal with some improvements.
Hi! Just a quick suggestion of an exception that could be made more clear: when trying to DVC pull a dataset stored in an S3 bucket that the user doesn't have access to, the following traceback occurs:
File "~/.virtualenvs/sandbox3/lib/python3.6/site-packages/concurrent/futures/_base.py", line 381
raise exception_type, self._exception, self._traceback
^
SyntaxError: invalid syntax
ERROR: unexpected error - An error occurred (403) when calling the HeadObject operation: Forbidden
It would be much easier to understand if the error raised was some variant on AccessDenied, rather than a SyntaxError.
Hi @lbernick !
That SyntaxError is actually a bug. Could you provide dvc version output and also show full traceback, please?
Hi @efiop ,
I'm the user @lbernick mentioned. Here is the full traceback:
Traceback (most recent call last):
File "~/.virtualenvs/sandbox3/bin/dvc", line 6, in <module>
from dvc.main import main
File "~/.virtualenvs/sandbox3/lib/python3.6/site-packages/dvc/main.py", line 6, in <module>
from dvc import analytics
File "~/.virtualenvs/sandbox3/lib/python3.6/site-packages/dvc/analytics.py", line 17, in <module>
from dvc.repo import Repo
File "~/.virtualenvs/sandbox3/lib/python3.6/site-packages/dvc/repo/__init__.py", line 18, in <module>
from dvc.remote.base import RemoteActionNotImplemented
File "~/.virtualenvs/sandbox3/lib/python3.6/site-packages/dvc/remote/__init__.py", line 4, in <module>
from dvc.remote.azure import RemoteAZURE
File "~/.virtualenvs/sandbox3/lib/python3.6/site-packages/dvc/remote/azure.py", line 12, in <module>
from dvc.remote.base import RemoteBASE
File "~/.virtualenvs/sandbox3/lib/python3.6/site-packages/dvc/remote/base.py", line 7, in <module>
from concurrent.futures import ThreadPoolExecutor
File "~/.virtualenvs/sandbox3/lib/python3.6/site-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "~/.virtualenvs/sandbox3/lib/python3.6/site-packages/concurrent/futures/_base.py", line 381
raise exception_type, self._exception, self._traceback
^
SyntaxError: invalid syntax
ERROR: unexpected error - An error occurred (403) when calling the HeadObject operation: Forbidden
and dvc version gives:
DVC version: 0.86.4
Python version: 3.6.6
Platform: Darwin-18.7.0-x86_64-i386-64bit
Binary: False
Package: pip
let me know if I can provide any other information.
Hi @ccurme ! Thanks for clarifying! Looks like you have an issue with your environment (e.g. https://github.com/pypa/pipenv/issues/1589). I would try re-creating your virtualenv to see if that helps. Could you give it a try, please?
Hi @efiop ,
This resolved my issue, thanks!
Hi!
ERROR: unexpected error - An error occurred (403) when calling the HeadObject operation: Forbidden
This error (even without being called aSyntaxErroris still not very informative as recently mentioned in https://discuss.dvc.org/t/dvc-push-to-public-s3-bucket/457
I think it would be great to improve it a little so the user can tell the problem has to do with the AWS credentials. Should I open a separate issue for this? Thanks