File: exceptions.py

package info (click to toggle)
dput-ng 1.44
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,052 kB
  • sloc: python: 3,927; makefile: 154; sh: 10
file content (101 lines) | stat: -rw-r--r-- 2,678 bytes parent folder | download | duplicates (6)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# -*- coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4

# Copyright (c) 2012 dput authors
#
# 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 2 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
"""
Base exceptions. All hooks and internal modules should subclass
Exceptions listed here.
"""


class DputError(Exception):
    """
    Most basic dput error. All other Exceptions must inherit from this
    when it is sensable to do so.
    """
    pass


class DcutError(Exception):
    pass


class DputConfigurationError(DputError):
    """
    Errors in the parsing or retrieving of configuration files should raise
    an instance of this, or a subclass thereof.
    """
    pass


class NoSuchConfigError(DputError):
    """
    Thrown when dput can not find a Configuration file or block that is
    requested.
    """
    pass


class InvalidConfigError(DputError):
    """
    Config file was loaded properly, but it was missing part of it's
    required fields.
    """
    pass


class ChangesFileException(DputError):
    """
    Thrown when there's an error processing / verifying a .changes file
    (most often via the :class:`dput.changes.Changes` object)
    """

    def __init__(self, message, gpg_stderr=None):
        super(ChangesFileException, self).__init__(message)
        self.gpg_stderr = gpg_stderr


class DscFileException(DputError):
    """
    Thrown when there's an error processing / verifying a .dsc file
    (most often via the :class:`dput.changes.Dsc` object)
    """
    pass


class UploadException(DputError):
    """
    Thrown when there's an error uploading, or creating an uploader. Usually
    thrown by a subclass of the :class:`dput.uploader.AbstractUploader`
    """
    pass


class HookException(DputError):
    """
    Thrown when there's an error checking, or creating a checker. Usually
    thrown by a checker invoked by :class:`dput.checker.run_hooks`.
    """
    pass


class NoSuchHostError(DputError):
    """
    Thrown when the network doesn't allow us to connect to a host.
    """
    pass