A Python robot that edits Wikipedia and interacts with people over IRC https://en.wikipedia.org/wiki/User:EarwigBot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

exceptions.py 1.6 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # -*- coding: utf-8 -*-
  2. """
  3. EarwigBot's Wiki Toolset: Exceptions
  4. This module contains all exceptions used by the wiki.tools package.
  5. """
  6. class WikiToolsetError(Exception):
  7. """Base exception class for errors in the Wiki Toolset."""
  8. class SiteNotFoundError(WikiToolsetError):
  9. """A site matching the args given to get_site() could not be found in the
  10. config file."""
  11. class SiteAPIError(WikiToolsetError):
  12. """We couldn't connect to a site's API, perhaps because the server doesn't
  13. exist, our URL is wrong or incomplete, or they're having temporary
  14. problems."""
  15. class LoginError(WikiToolsetError):
  16. """An error occured while trying to login. Perhaps the username/password is
  17. incorrect."""
  18. class PermissionsError(WikiToolsetError):
  19. """We tried to do something we don't have permission to, like a non-admin
  20. trying to delete a page, or trying to edit a page when no login information
  21. was provided."""
  22. class NamespaceNotFoundError(WikiToolsetError):
  23. """A requested namespace name or namespace ID does not exist."""
  24. class PageNotFoundError(WikiToolsetError):
  25. """Attempting to get certain information about a page that does not
  26. exist."""
  27. class InvalidPageError(WikiToolsetError):
  28. """Attempting to get certain information about a page whose title is
  29. invalid."""
  30. class RedirectError(WikiToolsetError):
  31. """Page's get_redirect_target() method failed because the page is either
  32. not a redirect, or it is malformed."""
  33. class UserNotFoundError(WikiToolsetError):
  34. """Attempting to get certain information about a user that does not
  35. exist."""