[PATCH 1 of 2] error: add ProgrammingError

Gábor STEFANIK Gabor.STEFANIK at nng.com
Tue Dec 13 11:58:16 EST 2016


>


--------------------------------------------------------------------------
This message, including its attachments, is confidential. For more information please read NNG's email policy here:
http://www.nng.com/emailpolicy/
By responding to this email you accept the email policy.


-----Original Message-----
> From: Mercurial-devel [mailto:mercurial-devel-bounces at mercurial-scm.org]
> On Behalf Of Gábor STEFANIK
> Sent: Tuesday, December 13, 2016 5:53 PM
> To: Jun Wu <quark at fb.com>; mercurial-devel at mercurial-scm.org
> Subject: RE: [PATCH 1 of 2] error: add ProgrammingError
>
> >
>
>
> --------------------------------------------------------------------------
> This message, including its attachments, is confidential. For more information
> please read NNG's email policy here:
> http://www.nng.com/emailpolicy/
> By responding to this email you accept the email policy.
>
>
> -----Original Message-----
> > From: Mercurial-devel
> > [mailto:mercurial-devel-bounces at mercurial-scm.org]
> > On Behalf Of Jun Wu
> > Sent: Tuesday, December 6, 2016 6:14 PM
> > To: mercurial-devel at mercurial-scm.org
> > Subject: [PATCH 1 of 2] error: add ProgrammingError
> >
> > # HG changeset patch
> > # User Jun Wu <quark at fb.com>
> > # Date 1481036267 0
> > #      Tue Dec 06 14:57:47 2016 +0000
> > # Node ID 67bcd43e64ca03f486a817fccf38e83020b06793
> > # Parent  2463b16bbd3710b619e0e948651db9948341f990
> > # Available At https://bitbucket.org/quark-zju/hg-draft
> > #              hg pull https://bitbucket.org/quark-zju/hg-draft -r 67bcd43e64ca
> > error: add ProgrammingError
> >
> > We have requirement to express "this is clearly an error caused by the
> > programmer". The code base uses RuntimeError for that in some places,
> > not ideal. So let's add a formal exception for that.
> >
> > diff --git a/mercurial/error.py b/mercurial/error.py
> > --- a/mercurial/error.py
> > +++ b/mercurial/error.py
> > @@ -169,4 +169,7 @@ class PushRaced(RuntimeError):
> >      """An exception raised during unbundling that indicate a push race"""
> >
> > +class ProgrammingError(RuntimeError):
>
> I would suggest InternalError, assuming it's not reserved by the Python
> language, or used for something else already in Hg.
> "ProgrammingError" could be interpreted as a programming error in Hg, but
> also a programming error in tracked code. It's more of a stretch than with
> "developer", but "internal" is still clearer than "programming".
>
> See also: GCC's ICEs (but "in-SCM exception" is clunky IMO)

Looks like I was wrong - ICE apparently stands for "internal compiler error", not "in-compiler exception".
So, InternalError is in agreement with GCC's nomenclature.

>
> > +    """Raised if a developer has made some mistake"""
> > +
> >  # bundle2 related errors
> >  class BundleValueError(ValueError):
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel at mercurial-scm.org
> > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list