RE: [PATCH 1 of 2] error: add ProgrammingError

2016-12-13 Thread Gábor STEFANIK
>


--
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-boun...@mercurial-scm.org]
> On Behalf Of Gábor STEFANIK
> Sent: Tuesday, December 13, 2016 5:53 PM
> To: Jun Wu <qu...@fb.com>; mercurial-devel@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-boun...@mercurial-scm.org]
> > On Behalf Of Jun Wu
> > Sent: Tuesday, December 6, 2016 6:14 PM
> > To: mercurial-devel@mercurial-scm.org
> > Subject: [PATCH 1 of 2] error: add ProgrammingError
> >
> > # HG changeset patch
> > # User Jun Wu <qu...@fb.com>
> > # Date 1481036267 0
> > #  Tue Dec 06 14:57:47 2016 +
> > # 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@mercurial-scm.org
> > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


RE: [PATCH 1 of 2] error: add ProgrammingError

2016-12-13 Thread Gábor STEFANIK
>


--
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-boun...@mercurial-scm.org]
> On Behalf Of Jun Wu
> Sent: Tuesday, December 6, 2016 6:14 PM
> To: mercurial-devel@mercurial-scm.org
> Subject: [PATCH 1 of 2] error: add ProgrammingError
>
> # HG changeset patch
> # User Jun Wu <qu...@fb.com>
> # Date 1481036267 0
> #  Tue Dec 06 14:57:47 2016 +
> # 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)

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


Re: [PATCH 1 of 2] error: add ProgrammingError

2016-12-11 Thread timeless
Jun Wu wrote:
> +class ProgrammingError(RuntimeError):
> +"""Raised if a developer has made some mistake"""

I object to "developer"

you probably mean "mercurial (core or extension) developer", not
"generic developer".
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel