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

exceptions: general refactor #3050

Closed
ghost opened this issue Jan 3, 2020 · 6 comments
Closed

exceptions: general refactor #3050

ghost opened this issue Jan 3, 2020 · 6 comments
Labels
discussion requires active participation to reach a conclusion p3-nice-to-have It should be done this or next sprint refactoring Factoring and re-factoring

Comments

@ghost
Copy link

ghost commented Jan 3, 2020

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 -- Create error handler for remotes #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.

@triage-new-issues triage-new-issues bot added the triage Needs to be triaged label Jan 3, 2020
@ghost ghost added discussion requires active participation to reach a conclusion refactoring Factoring and re-factoring labels Jan 3, 2020
@triage-new-issues triage-new-issues bot removed the triage Needs to be triaged label Jan 3, 2020
@efiop efiop added the p3-nice-to-have It should be done this or next sprint label Jan 7, 2020
@lbernick
Copy link

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.

@efiop
Copy link
Contributor

efiop commented Feb 21, 2020

Hi @lbernick !

That SyntaxError is actually a bug. Could you provide dvc version output and also show full traceback, please?

@ccurme
Copy link

ccurme commented Feb 21, 2020

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.

@efiop
Copy link
Contributor

efiop commented Feb 21, 2020

Hi @ccurme ! Thanks for clarifying! Looks like you have an issue with your environment (e.g. pypa/pipenv#1589). I would try re-creating your virtualenv to see if that helps. Could you give it a try, please?

@ccurme
Copy link

ccurme commented Feb 24, 2020

Hi @efiop ,

This resolved my issue, thanks!

@jorgeorpinel
Copy link
Contributor

Hi!

ERROR: unexpected error - An error occurred (403) when calling the HeadObject operation: Forbidden
This error (even without being called a SyntaxError is 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion requires active participation to reach a conclusion p3-nice-to-have It should be done this or next sprint refactoring Factoring and re-factoring
Projects
None yet
Development

No branches or pull requests

4 participants