libervia-backend/libervia/backend/plugins/plugin_xep_0373/exceptions.py
2026-03-31 12:57:17 +02:00

63 lines
1.9 KiB
Python

#!/usr/bin/env python3
# Libervia plugin for OpenPGP for XMPP
# Copyright (C) 2025-2026 Jérôme Poisosn (goffi@goffi.org)
# Copyright (C) 2022-2026 Tim Henkes (me@syndace.dev)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
class VerificationError(Exception):
"""
Raised by verifying methods of :class:`XEP_0373` on semantical verification errors.
"""
class XMPPInteractionFailed(Exception):
"""
Raised by methods of :class:`XEP_0373` on XMPP interaction failure. The reason this
exception exists is that the exceptions raised by XMPP interactions are not properly
documented for the most part, thus all exceptions are caught and wrapped in instances
of this class.
"""
class InvalidPacket(ValueError):
"""
Raised by methods of :class:`GPGProvider` when an invalid packet is encountered.
"""
class DecryptionFailed(Exception):
"""
Raised by methods of :class:`GPGProvider` on decryption failures.
"""
class VerificationFailed(Exception):
"""
Raised by methods of :class:`GPGProvider` on verification failures.
"""
class UnknownKey(ValueError):
"""
Raised by methods of :class:`GPGProvider` when an unknown key is referenced.
"""
class GPGProviderError(Exception):
"""
Raised by methods of :class:`GPGProvider` on internal errors.
"""