1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 'Declarations for the errors'
16
19
22
25
28
31
34
37
40
41 CODES = {
42 0x00: None,
43 0x20: I2CPendingError('Pending communication transaction in progress'),
44 0x40: DirProtError('Specified mailbox queue is empty'),
45 0x81: SysProtError('No more handles'),
46 0x82: SysProtError('No space'),
47 0x83: SysProtError('No more files'),
48 0x84: SysProtError('End of file expected'),
49 0x85: SysProtError('End of file'),
50 0x86: SysProtError('Not a linear file'),
51 0x87: FileNotFound('File not found'),
52 0x88: SysProtError('Handle already closed'),
53 0x89: SysProtError('No linear space'),
54 0x8A: SysProtError('Undefined error'),
55 0x8B: SysProtError('File is busy'),
56 0x8C: SysProtError('No write buffers'),
57 0x8D: SysProtError('Append not possible'),
58 0x8E: SysProtError('File is full'),
59 0x8F: FileExistsError('File exists'),
60 0x90: ModuleNotFound('Module not found'),
61 0x91: SysProtError('Out of bounds'),
62 0x92: SysProtError('Illegal file name'),
63 0x93: SysProtError('Illegal handle'),
64 0xBD: DirProtError('Request failed (i.e. specified file not found)'),
65 0xBE: DirProtError('Unknown command opcode'),
66 0xBF: DirProtError('Insane packet'),
67 0xC0: DirProtError('Data contains out-of-range values'),
68 0xDD: DirProtError('Communication bus error'),
69 0xDE: DirProtError('No free memory in communication buffer'),
70 0xDF: DirProtError('Specified channel/connection is not valid'),
71 0xE0: I2CError('Specified channel/connection not configured or busy'),
72 0xEC: DirProtError('No active program'),
73 0xED: DirProtError('Illegal size specified'),
74 0xEE: DirProtError('Illegal mailbox queue ID specified'),
75 0xEF: DirProtError('Attempted to access invalid field of a structure'),
76 0xF0: DirProtError('Bad input or output specified'),
77 0xFB: DirProtError('Insufficient memory available'),
78 0xFF: DirProtError('Bad arguments'),
79 }
80
82 if status:
83 ex = CODES.get(status)
84 if ex:
85 raise ex
86 else:
87 raise ProtocolError, status
88