~ubuntu-branches/ubuntu/utopic/scons/utopic-proposed

« back to all changes in this revision

Viewing changes to engine/SCons/Optik/errors.py

  • Committer: Bazaar Package Importer
  • Author(s): Mark Brown
  • Date: 2004-08-24 08:57:22 UTC
  • mfrom: (0.2.1 upstream) (1.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040824085722-hfk4f0pjbyu0ebxv
Tags: 0.96.1-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""optik.errors
 
2
 
 
3
Exception classes used by Optik.
 
4
"""
 
5
 
 
6
__revision__ = "/home/scons/scons/branch.0/baseline/src/engine/SCons/Optik/errors.py 0.96.1.D001 2004/08/23 09:55:29 knight"
 
7
 
 
8
# Original Optik revision this is based on:
 
9
__Optik_revision__ = "errors.py,v 1.5 2002/02/13 23:29:47 gward Exp"
 
10
 
 
11
# Copyright (c) 2001 Gregory P. Ward.  All rights reserved.
 
12
# See the README.txt distributed with Optik for licensing terms.
 
13
 
 
14
# created 2001/10/17 GPW (from optik.py)
 
15
 
 
16
 
 
17
class OptikError (Exception):
 
18
    def __init__ (self, msg):
 
19
        self.msg = msg
 
20
 
 
21
    def __str__ (self):
 
22
        return self.msg
 
23
 
 
24
 
 
25
class OptionError (OptikError):
 
26
    """
 
27
    Raised if an Option instance is created with invalid or
 
28
    inconsistent arguments.
 
29
    """
 
30
 
 
31
    def __init__ (self, msg, option):
 
32
        self.msg = msg
 
33
        self.option_id = str(option)
 
34
 
 
35
    def __str__ (self):
 
36
        if self.option_id:
 
37
            return "option %s: %s" % (self.option_id, self.msg)
 
38
        else:
 
39
            return self.msg
 
40
 
 
41
class OptionConflictError (OptionError):
 
42
    """
 
43
    Raised if conflicting options are added to an OptionParser.
 
44
    """
 
45
 
 
46
class OptionValueError (OptikError):
 
47
    """
 
48
    Raised if an invalid option value is encountered on the command
 
49
    line.
 
50
    """
 
51
 
 
52
class BadOptionError (OptikError):
 
53
    """
 
54
    Raised if an invalid or ambiguous option is seen on the command-line.
 
55
    """