megapy/src/mega/__init__.py
Ethan Dalool 62871e3240 Add separate classes for API exceptions, raise error_for_code().
This makes the caller's life easier. They can catch
mega.errors.EFAILED instead of catching mega.errors.RequestError
and checking the message attribute.
Because these classes inherit from RequestError, and they have a code
and message attribute, anyone currently catching RequestError should
not have any backwards compatibility issues.
Furthermore, this fixes an existing issue in the codebase where
RequestError is raised with a custom string message, which was causing
IndexError since that message wasn't in CODE_TO_DESCRIPTIONS.
2020-03-23 18:54:29 -07:00

2 lines
52 B
Python

from .mega import Mega # noqa
from . import errors