File: error.py

package info (click to toggle)
nxt-python 3.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 812 kB
  • sloc: python: 6,857; xml: 22; makefile: 20; sh: 4
file content (74 lines) | stat: -rw-r--r-- 1,841 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# nxt.error module -- NXT brick error handling
# Copyright (C) 2006, 2007  Douglas P Lau
# Copyright (C) 2009  Marcus Wanner
# Copyright (C) 2021  Nicolas Schodet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.


class ProtocolError(Exception):
    """Raised on error with the NXT brick protocol."""

    pass


class SystemProtocolError(ProtocolError):
    """Raised on error with the NXT brick protocol for a system command."""

    pass


class FileExistsError(SystemProtocolError):
    """Raised when trying to create a file which already exists."""

    pass


class FileNotFoundError(SystemProtocolError):
    """Raised when trying to access a file which does not exists."""

    pass


class ModuleNotFoundError(SystemProtocolError):
    """Raised when trying to access a module which does not exists."""

    pass


class DirectProtocolError(ProtocolError):
    """Raised on error with the NXT brick protocol for a direct command."""

    pass


class EmptyMailboxError(DirectProtocolError):
    """Raised when trying to read from empty mailbox."""

    pass


class I2CError(DirectProtocolError):
    """Raised on I2C error on a sensor port."""

    pass


class NoActiveProgramError(DirectProtocolError):
    """Raised when no program is running."""

    pass


class I2CPendingError(I2CError):
    """Raised when an I2C transaction on a sensor port is still in progress."""

    pass