1 """Status Word (SW) Exceptions
2
3 This module defines the exceptions raised by status word errors or warnings.
4
5 __author__ = "http://www.gemalto.com"
6
7 Copyright 2001-2012 gemalto
8 Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
9
10 This file is part of pyscard.
11
12 pyscard is free software; you can redistribute it and/or modify
13 it under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
16
17 pyscard is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU Lesser General Public License for more details.
21
22 You should have received a copy of the GNU Lesser General Public License
23 along with pyscard; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 """
26
27
29 """Base class for status word exceptions.
30
31 Status word exceptions are generated when errors and warnings are detected
32 in the sw1 and sw2 bytes of the response apdu.
33
34 """
35
36 - def __init__(self, data, sw1, sw2, message=""):
37 self.message = message
38 """response apdu data"""
39 self.data = data
40 """response apdu sw1"""
41 self.sw1 = sw1
42 """response apdu sw2"""
43 self.sw2 = sw2
44
46 return repr('Status word exception: ' + self.message + '!')
47
48
50 """Raised when a warning processing is detected from sw1, sw2.
51 Examples of warning processing exception: sw1=62 or sw=63 (ISO7816-4)."""
52
53 - def __init__(self, data, sw1, sw2, message=""):
56
57
59 """Raised when an execution error is detected from sw1, sw2.
60 Examples of execution error: sw1=64 or sw=65 (ISO7816-4)."""
61
62 - def __init__(self, data, sw1, sw2, message=""):
65
66
74
75
77 """Raised when a checking error is detected from sw1, sw2.
78 Examples of checking error: sw1=67 to 6F (ISO781604)."""
79
80 - def __init__(self, data, sw1, sw2, message=""):
83