Mercurial > public > mercurial-scm > hg-stable
annotate mercurial/error.py @ 8226:8b2cd04a6e97
put license and copyright info into comment blocks
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Sun, 26 Apr 2009 01:13:08 +0200 |
parents | 46293a0c7e9f |
children | 0a9542703300 |
rev | line source |
---|---|
8226
8b2cd04a6e97
put license and copyright info into comment blocks
Martin Geisler <mg@lazybytes.net>
parents:
8225
diff
changeset
|
1 # error.py - Mercurial exceptions |
8b2cd04a6e97
put license and copyright info into comment blocks
Martin Geisler <mg@lazybytes.net>
parents:
8225
diff
changeset
|
2 # |
8b2cd04a6e97
put license and copyright info into comment blocks
Martin Geisler <mg@lazybytes.net>
parents:
8225
diff
changeset
|
3 # This allows us to catch exceptions at higher levels without forcing imports |
8b2cd04a6e97
put license and copyright info into comment blocks
Martin Geisler <mg@lazybytes.net>
parents:
8225
diff
changeset
|
4 # |
8b2cd04a6e97
put license and copyright info into comment blocks
Martin Geisler <mg@lazybytes.net>
parents:
8225
diff
changeset
|
5 # Copyright 2005-2008 Matt Mackall <mpm@selenic.com> |
8b2cd04a6e97
put license and copyright info into comment blocks
Martin Geisler <mg@lazybytes.net>
parents:
8225
diff
changeset
|
6 # |
8b2cd04a6e97
put license and copyright info into comment blocks
Martin Geisler <mg@lazybytes.net>
parents:
8225
diff
changeset
|
7 # This software may be used and distributed according to the terms of the |
8b2cd04a6e97
put license and copyright info into comment blocks
Martin Geisler <mg@lazybytes.net>
parents:
8225
diff
changeset
|
8 # GNU General Public License version 2, incorporated herein by reference. |
7633 | 9 |
10 # Do not import anything here, please | |
11 | |
12 class RevlogError(Exception): | |
13 pass | |
14 | |
15 class LookupError(RevlogError, KeyError): | |
16 def __init__(self, name, index, message): | |
17 self.name = name | |
18 if isinstance(name, str) and len(name) == 20: | |
19 from node import short | |
20 name = short(name) | |
21 RevlogError.__init__(self, '%s@%s: %s' % (index, name, message)) | |
22 | |
23 def __str__(self): | |
24 return RevlogError.__str__(self) | |
7636 | 25 |
26 class ParseError(Exception): | |
27 """Exception raised on errors in parsing the command line.""" | |
7637 | 28 |
8144
fca54469480e
ui: introduce new config parser
Matt Mackall <mpm@selenic.com>
parents:
7947
diff
changeset
|
29 class ConfigError(Exception): |
fca54469480e
ui: introduce new config parser
Matt Mackall <mpm@selenic.com>
parents:
7947
diff
changeset
|
30 'Exception raised when parsing config files' |
fca54469480e
ui: introduce new config parser
Matt Mackall <mpm@selenic.com>
parents:
7947
diff
changeset
|
31 |
7637 | 32 class RepoError(Exception): |
33 pass | |
34 | |
35 class CapabilityError(RepoError): | |
36 pass | |
7640 | 37 |
38 class LockError(IOError): | |
39 def __init__(self, errno, strerror, filename, desc): | |
40 IOError.__init__(self, errno, strerror, filename) | |
41 self.desc = desc | |
42 | |
43 class LockHeld(LockError): | |
44 def __init__(self, errno, filename, desc, locker): | |
45 LockError.__init__(self, errno, 'Lock held', filename, desc) | |
46 self.locker = locker | |
47 | |
48 class LockUnavailable(LockError): | |
49 pass | |
7641
d2f753830f80
error: move UnexpectedOutput (now ResponseError)
Matt Mackall <mpm@selenic.com>
parents:
7640
diff
changeset
|
50 |
d2f753830f80
error: move UnexpectedOutput (now ResponseError)
Matt Mackall <mpm@selenic.com>
parents:
7640
diff
changeset
|
51 class ResponseError(Exception): |
d2f753830f80
error: move UnexpectedOutput (now ResponseError)
Matt Mackall <mpm@selenic.com>
parents:
7640
diff
changeset
|
52 """Raised to print an error with part of output and exit.""" |
d2f753830f80
error: move UnexpectedOutput (now ResponseError)
Matt Mackall <mpm@selenic.com>
parents:
7640
diff
changeset
|
53 |
7643
9a1ea6587557
error: move UnknownCommand and AmbiguousCommand
Matt Mackall <mpm@selenic.com>
parents:
7641
diff
changeset
|
54 class UnknownCommand(Exception): |
9a1ea6587557
error: move UnknownCommand and AmbiguousCommand
Matt Mackall <mpm@selenic.com>
parents:
7641
diff
changeset
|
55 """Exception raised if command is not in the command table.""" |
9a1ea6587557
error: move UnknownCommand and AmbiguousCommand
Matt Mackall <mpm@selenic.com>
parents:
7641
diff
changeset
|
56 |
9a1ea6587557
error: move UnknownCommand and AmbiguousCommand
Matt Mackall <mpm@selenic.com>
parents:
7641
diff
changeset
|
57 class AmbiguousCommand(Exception): |
9a1ea6587557
error: move UnknownCommand and AmbiguousCommand
Matt Mackall <mpm@selenic.com>
parents:
7641
diff
changeset
|
58 """Exception raised if command shortcut matches more than one command.""" |
9a1ea6587557
error: move UnknownCommand and AmbiguousCommand
Matt Mackall <mpm@selenic.com>
parents:
7641
diff
changeset
|
59 |
7644
182b7114d35a
error: move SignalInterrupt
Matt Mackall <mpm@selenic.com>
parents:
7643
diff
changeset
|
60 # derived from KeyboardInterrupt to simplify some breakout code |
182b7114d35a
error: move SignalInterrupt
Matt Mackall <mpm@selenic.com>
parents:
7643
diff
changeset
|
61 class SignalInterrupt(KeyboardInterrupt): |
182b7114d35a
error: move SignalInterrupt
Matt Mackall <mpm@selenic.com>
parents:
7643
diff
changeset
|
62 """Exception raised on SIGTERM and SIGHUP.""" |
7646 | 63 |
64 class SignatureError(Exception): | |
65 pass | |
7947
a454eeb1b827
move util.Abort to error.py
Matt Mackall <mpm@selenic.com>
parents:
7646
diff
changeset
|
66 |
a454eeb1b827
move util.Abort to error.py
Matt Mackall <mpm@selenic.com>
parents:
7646
diff
changeset
|
67 class Abort(Exception): |
a454eeb1b827
move util.Abort to error.py
Matt Mackall <mpm@selenic.com>
parents:
7646
diff
changeset
|
68 """Raised if a command needs to print an error and exit.""" |