File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 1+ from textwrap import dedent
2+
13from ...exceptions .exceptions import DriverException
24from ...exceptions .driver_errors import DriverError
35
@@ -23,6 +25,14 @@ class YandexError(DriverError):
2325 """The token has expired or the token doesn't exist.""" ,
2426 )
2527
28+ access_denied = (
29+ "Access denied" ,
30+ dedent ("""\
31+ Access denied. The application probably does not have sufficient
32+ permissions to perform this action. You can change the application
33+ settings on this page: https://oauth.yandex.ru/.""" ),
34+ )
35+
2636
2737class YandexException (DriverException ):
2838 pass
Original file line number Diff line number Diff line change 99from yadisk .exceptions import RequestTimeoutError
1010from yadisk .exceptions import PathNotFoundError
1111from yadisk .exceptions import UnauthorizedError
12+ from yadisk .exceptions import ForbiddenError
1213
1314from .errors import YandexException
1415from .errors import YandexError
@@ -40,6 +41,8 @@ def inner(*args, **kwargs):
4041 raise YandexException (* YandexError .path_not_found_error )
4142 except UnauthorizedError :
4243 raise YandexException (* YandexError .invalid_token_error )
44+ except ForbiddenError :
45+ raise YandexException (* YandexError .access_denied )
4346 except FileNotFoundError :
4447 raise YandexException (* FileError .not_exists_error )
4548 except PermissionError :
You can’t perform that action at this time.
0 commit comments