File: errors.py

package info (click to toggle)
bzr-builddeb 0.95
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 604 kB
  • ctags: 639
  • sloc: python: 5,300; makefile: 51; sh: 1
file content (88 lines) | stat: -rw-r--r-- 2,657 bytes parent folder | download
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
#    errors.py -- Error classes
#    Copyright (C) 2006 James Westby <jw+debian@jameswestby.net>
#    
#    This file is part of bzr-builddeb.
#
#    bzr-builddeb 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.
#
#    bzr-builddeb 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 bzr-builddeb; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#

from bzrlib.errors import BzrError


class DebianError(BzrError):
  _fmt = """A Debian packaging error occurred: %(message)s"""

  def __init__(self, message):
    BzrError.__init__(self)
    self.message = message

class NoSourceDirError(DebianError):
  _fmt = """There is no existing source directory to use. Use --export-only or 
  --dont-purge to get one that can be used"""

  def __init__(self):
    DebianError.__init__(self, None)

class BuildFailedError(DebianError):
  _fmt = """The build failed."""
  def __init__(self):
    DebianError.__init__(self, None)

class StopBuild(DebianError):
  _fmt = """Stopping the build: %(reason)s."""

  def __init__(self, reason):
    BzrError.__init__(self)
    self.reason = reason

class MissingChangelogError(DebianError):
  _fmt = """Could not find changelog at %(location)s."""

  def __init__(self, locations):
    BzrError.__init__(self)
    self.location = locations

class AddChangelogError(DebianError):
  _fmt = """Please add %(changelog)s to the branch using bzr add."""

  def __init__(self, changelog):
    BzrError.__init__(self)
    self.changelog = changelog

class ImportError(DebianError):
  _fmt = """The files could not be imported: %(reason)s"""

  def __init__(self, reason):
    BzrError.__init__(self)
    self.reason = reason

class HookFailedError(BzrError):
  _fmt = """The %(hook_name)s hook failed."""

  def __init__(self, hook_name):
    BzrError.__init__(self)
    self.hook_name = hook_name


class OnlyImportSingleDsc(BzrError):
  _fmt = """You are only allowed to import one version in incremental mode."""

class UnknownType(BzrError):
  _fmt = """Cannot extract "%(path)s" from archive as it is an unknown type."""

  def __init__(self, path):
    self.path = path

# vim: ts=2 sts=2 sw=2