blob: 86082e4afe6cd049dbea4ac912b0ae18f14361e2 [file] [log] [blame]
Alex Gaynorf1a3fc02013-11-02 14:03:34 -07001# Licensed under the Apache License, Version 2.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10# implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
Alex Gaynorc37feed2014-03-08 08:32:56 -080014from __future__ import absolute_import, division, print_function
15
Alex Gaynor738ac5a2013-11-02 14:10:38 -070016
Alex Stapleton112963e2014-03-26 17:39:29 +000017class _Reasons(object):
18 BACKEND_MISSING_INTERFACE = object()
Alex Stapletonf33ccfcc2014-03-26 17:44:14 +000019 UNSUPPORTED_HASH = object()
20 UNSUPPORTED_CIPHER = object()
21 UNSUPPORTED_PADDING = object()
Alex Gaynor7a489db2014-03-22 15:09:34 -070022
23
Alex Gaynor25d24de2014-03-01 09:36:02 -080024class UnsupportedAlgorithm(Exception):
Alex Gaynor7a489db2014-03-22 15:09:34 -070025 def __init__(self, message, cause=None):
26 super(UnsupportedAlgorithm, self).__init__(message)
27 self._cause = cause
David Reid152d6be2013-11-12 16:41:13 -080028
29
30class AlreadyFinalized(Exception):
31 pass
Paul Kehrer22e80cb2013-11-20 21:27:00 -060032
33
Paul Kehrerce9c6112013-11-22 14:10:59 -060034class AlreadyUpdated(Exception):
35 pass
36
37
Paul Kehrercc9ec982013-11-21 11:21:35 -060038class NotYetFinalized(Exception):
Paul Kehrer22e80cb2013-11-20 21:27:00 -060039 pass
Paul Kehrera4bfc082013-11-22 19:57:37 -060040
41
42class InvalidTag(Exception):
43 pass
Julian Krause2288e302013-12-17 21:26:23 -080044
45
46class InvalidSignature(Exception):
47 pass
Alex Gaynor0d62fb02014-01-24 12:19:05 -060048
49
50class InternalError(Exception):
51 pass
Alex Gaynorb2774f52014-01-27 11:05:29 -080052
53
54class InvalidKey(Exception):
55 pass
Ayrxa7769112014-02-13 12:27:56 +080056
57
58class InvalidToken(Exception):
59 pass