Commit Graph

58 Commits

Author SHA1 Message Date
Siddharth Agarwal
a13e973d08 error: add a structured exception for unsupported merge records
We're going to use this in summary to print a better error message.
2015-11-17 14:10:12 -08:00
Siddharth Agarwal
6e6f3927e3 error: add structured exception for EOF at prompt
We'll catch this exception for promptchoice queries to provide better error
handling.
2015-11-10 00:46:45 -08:00
Augie Fackler
6caeb62341 error: remove superfluous pass statements 2015-10-15 09:52:32 -04:00
Siddharth Agarwal
d01bcde561 hook: raise a separate exception for when loading a hook fails
For easier catching.
2015-10-12 18:49:23 -07:00
Pierre-Yves David
e4483e415c update: introduce a 'UpdateAbort' exception
The 'postincoming' function used by 'hg pull --update' and 'hg unbundle' is
catching 'Abort' exceptions to intercept failed update. This feel a bit too
wide to me, so I'm introducing a more precise exception to specify update
destination issues.
2015-10-05 04:26:26 -07:00
Gregory Szorc
c55df1f741 exchange: refactor bundle specification parsing
The old code was tailored to `hg bundle` usage and not appropriate for
use as a general API, which clone bundles will require. The code has
been rewritten to make it more generally suitable.

We introduce dedicated error types to represent invalid and unsupported
bundle specifications. The reason we need dedicated error types (rather
than error.Abort) is because clone bundles will want to catch these
exception as part of filtering entries. We don't want to swallow
error.Abort on principle.
2015-10-13 10:57:54 -07:00
Siddharth Agarwal
07b2481d7b error: make lock inheritance contract violations a subclass of RuntimeError
This is more appropriate, per Pierre-Yves David.
2015-09-25 12:56:05 -07:00
Pierre-Yves David
485efcee1f bundle2: allow to specify unsupported value on error
A client may support an argument but not some of its values (eg: coming
"compression" parameters). We allow this case to be carried in the
exception.
2015-09-23 11:55:27 -07:00
Pierre-Yves David
2aa8064fde bundle2: rename error exception class for unsupported feature
The original name explicitly mention "Part", however it is also used outside of
parts related feature. We rename from 'UnsupportedPartError' to
'BundleUnknownFeatureError' to fix this.
2015-09-23 11:44:52 -07:00
Siddharth Agarwal
9bb5535bd0 error: add an exception to indicate lock inheritance API contract violations 2015-09-24 10:53:16 -07:00
Gregory Szorc
62db11fad0 error: use absolute_import 2015-08-08 19:09:09 -07:00
Pierre-Yves David
4386f8310a bundle2: introduce a PushkeyFail error to abort unbundle on pushkey error
The pushkey code is generic and the server side has little context on what the
client is trying to achieve. Generating interesting error messages server side
would be challenging. Instead we introduce a dedicated exception that carries more
data. In particular, it carries the id of the part which failed that will allow
clients to display custom error messages depending on the part intent.

The processing and transfer-over-the-wire of this exception is to be implemented
in coming changesets.
2015-05-27 23:48:54 -07:00
Jordi Gutiérrez Hermoso
64f6058e68 error: derive RevlogError from HintException instead of Exception
This will allow us to now pass hints into this exception.
2015-05-21 16:20:34 -04:00
Jordi Gutiérrez Hermoso
4076b33bc3 error: refactor common hint-pattern into a common base class
I'm about to make another exception class require hints, so third
strike and you refactor.
2015-05-21 16:28:06 -04:00
Pierre-Yves David
8e64cd3aeb error: allow a 'hint' to OutOfBandError
This will be useful when changing the behavior of OutOfBandError for ssh in the
next changeset.
2015-05-20 18:17:40 -05:00
Augie Fackler
b35328ab65 error: add a new UnknownIdentifier error type
This will be used by the revset and fileset code to communicate more
specific errors to higher levels so that we might be able to offer
suggestions about what function might have been similar.
2015-01-26 14:31:01 -05:00
Mike Edgar
b4a5dfbe4d changegroup: emit full-replacement deltas if either revision is censored
To ensure that exchanged deltas in the presence of censored revisions can
always be applied to the recipient repository, the deltas must replace the
entire base text. To make this restriction reasonably enforceable, the delta
must do so with a single patch operation.

For background and broader design of the censorship feature, see:
http://mercurial.selenic.com/wiki/CensorPlan
2015-01-21 22:09:32 -05:00
Siddharth Agarwal
f7ee37c26e error.LookupError: rename 'message' property to something else
At least some installs of Python 2.6+ complain with:

    mercurial/error.py:26: DeprecationWarning: BaseException.message has been
        deprecated as of Python 2.6

This patch renames the property away from 'message' so that Python no longer
complains.
2015-02-18 16:45:16 -08:00
Mike Edgar
9635f8c5b0 revlog: in addgroup, reject ill-formed deltas based on censored nodes
To ensure interoperability when clones disagree about which file nodes are
censored, a restriction is made on deltas based on censored nodes. Any such
delta must replace the full text of the base in a single patch.

If the recipient of a delta considers the base to be censored and the delta
is not in the expected form, the recipient must reject it, as it can't know
if the source has also censored the base.

For background and broader design of the censorship feature, see:
http://mercurial.selenic.com/wiki/CensorPlan
2015-02-06 00:55:29 +00:00
Augie Fackler
e17e818366 error: update docstring on ParseError
It's now used by revsets and filesets.
2015-01-26 14:30:12 -05:00
Martin von Zweigbergk
20c7bd86fa error: store filename and message on LookupError for later
It may be useful to be able to get to the failed path and the
underlying error message when catching a LookupError, so let's make
them accessible.
2015-02-04 13:57:35 -08:00
Pierre-Yves David
6cf24b99de hook: raise a more specialized HookAbort exception when a hook fails
We need to gracefully handle some aborts for pushkey, especially
because it leads to a user-facing crash over the wireprotocols. So we
need a more specialized exception to catch.
2014-11-29 19:13:35 -08:00
Pierre-Yves David
5cf4921b01 repoview: add a FilteredRepoLookupError
This exception is a more precise RepoLookupError that will allow us to issue
a special message when we end up accessing a filtered revision.
2014-10-16 02:06:12 -07:00
Pierre-Yves David
37d7d2958f repoview: add a FilteredLookupError class
This exception is a more precise LookupError that will allow us to
issue a special message when we end up accessing a filtered revision.
2014-10-16 02:05:06 -07:00
Pierre-Yves David
ea3e835124 repoview: add a FilteredIndexError class
This exception is a more precise IndexError that will allow us to
issue a special message when we end up accessing a filtered revision.
2014-10-15 17:02:44 -07:00
Pierre-Yves David
2ecc46cd04 bundle2: add an UnsupportedPartError
We need the BundleValueError for format errors not related to part support. So
we add a specific class for part-support errors.
2014-10-15 03:22:47 -07:00
Mike Edgar
e100ea2d6a error: add CensoredNodeError, will be thrown when content deliberately erased
This change introduces the error plus a corresponding catch in dispatch, to
provide localized error messages.

The verb "censor" is used in this commit and all following to refer to erasing
the content of a revlog revision (filelog, for now) without recalculating node
IDs, leaving that revision invalid. Further work must be done to safely share
such revision data with compliant clients.

I find the analogy to censorship straightforward; for less politically
charged options, consider "erase", "excise", "expunge", or "blackhole".
2014-09-03 15:59:03 -04:00
Mike Edgar
be835fe233 error: use docstrings, not bare strings, for error classes 2014-08-30 12:22:20 +02:00
Brendan Cully
84c737c817 error: restore python 2.4 compatibility for BundleValueError
Under python 2.4, this:
    super(BundleValueError, self).__init__(msg)
raises this:
    TypeError: super() argument 1 must be type, not classobj
2014-06-10 17:00:31 -07:00
Pierre-Yves David
ee9ac67c31 bundle2: support None parttype in BundleValueError
This will be used for errors at the stream level.
2014-05-28 16:46:58 -07:00
Pierre-Yves David
e625997ab5 bundle2: introduce a `params` attribute to BundleValueError
We'll first use it for unsupported mandatory parameters on parts.
2014-05-28 15:53:34 -07:00
Pierre-Yves David
72ac6a7248 bundle2: introduce a parttype attribute to BundleValueError
We will use the Exception for more that just unknown part type.
2014-05-28 15:51:19 -07:00
Pierre-Yves David
d9f1652a77 bundle2: move exception classes into the error module
Exceptions should have known their place.
2014-05-28 15:31:05 -07:00
Pierre-Yves David
716843e5d3 bundle2: fix raising errors during heads checking
If the heads on the server differ from the ones reported seen by the client at
bundle time, we raise a PushRaced exception. However, the part raising the
exception was broken.

To fix it, we move the PushRaced class in the error module so it can be
accessible everywhere without an import cycle.

A test is also added to prevent regression.
2014-04-21 18:59:09 -07:00
Augie Fackler
91bbcff92c error: introduce new InterventionRequired exception
Future changes will use this type instead of util.Abort for signalling
the user that intervention is required, as in some rebase and histedit
aborts.
2013-02-08 14:26:03 -06:00
Takumi IINO
94c0d6fcb6 hgweb: show correct error message for i18n environment
If exception is error.LookupError and running in i18n environment,
below condition is always true.
Because msg is translated and dosen't contain 'manifest'.

    if util.safehasattr(err, 'name') and 'manifest' not in msg:

This patch creates a new exception class and uses it instead of
string match.
2013-02-15 18:07:14 +09:00
Andrew Pritchard
2d8acb3e0b wireproto: add out-of-band error class to allow remote repo to report errors
Older clients will still print the provided error message and not much else:
over ssh, this will be each line prefixed with 'remote: ' in addition to an
"abort: unexpected response: '\n'"; over http, this will be the '---%<---'
banners in addition to the 'does not appear to be a repository' message.

Currently, clients with this patch will display 'abort: remote error:\n' and
the provided error text, but it is trivial to style the error text however is
deemed appropriate.
2011-08-02 15:21:10 -04:00
Pierre-Yves David
f95a6cfc12 error: Add a hint argument to RepoError
This use the same mechanism than Abort. Except clause stay distinct
because RepoError add "!" at the end of the message.
2011-06-25 02:30:17 +02:00
Adrian Buehlmann
a8a418601f introduce new RequirementError (issue2649)
This improves the misleading error message

  $ hg identify
  abort: there is no Mercurial repository here (.hg not found)!

to the more explicit

  $ hg identify
  abort: requirement 'fake' not supported!

for all commands in commands.optionalrepo, which includes the identify
and serve commands in particular.

This is for the case when a new entry in .hg/requires will be defined
in a future Mercurial release.
2011-02-18 20:25:25 +01:00
Benoit Boissinot
a13fa80461 Abort: add a hint argument, printed in the next line inside parenthesis
discovery was using a custom made message for this purpose
push now returns -1 after aborting, instead of 1 previously
2010-07-15 14:41:22 +02:00
Matt Mackall
476998d3a8 error: fix up test-hgrc 2010-06-04 23:04:31 -05:00
Matt Mackall
969c51b3cf error: add new ParseError for various parsing errors 2010-06-04 20:57:26 -05:00
Matt Mackall
13c76ff349 error: change ParseError to CommandError 2010-06-04 20:19:53 -05:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Matt Mackall
c34b180a9c Make distinct lookup error for localrepo.lookup
This allows clone/share to correctly distinguish lookup errors from
corruption errors and catch only the former.
2009-08-31 10:58:33 -05:00
Martin Geisler
2c8901a1b9 turn some comments back into module docstrings 2009-04-26 01:24:49 +02:00
Martin Geisler
8e4bc1e9ad put license and copyright info into comment blocks 2009-04-26 01:13:08 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Matt Mackall
e8b3de6bf8 ui: introduce new config parser 2009-04-23 15:40:10 -05:00
Matt Mackall
2cddde0437 move util.Abort to error.py 2009-04-03 13:20:52 -05:00