Show More
@@ -162,6 +162,11 def dispatch(req): | |||||
162 | ret = None |
|
162 | ret = None | |
163 | try: |
|
163 | try: | |
164 | ret = _runcatch(req) |
|
164 | ret = _runcatch(req) | |
|
165 | except error.ProgrammingError as inst: | |||
|
166 | req.ui.warn(_('** ProgrammingError: %s\n') % inst) | |||
|
167 | if inst.hint: | |||
|
168 | req.ui.warn(_('** (%s)\n') % inst.hint) | |||
|
169 | raise | |||
165 | except KeyboardInterrupt as inst: |
|
170 | except KeyboardInterrupt as inst: | |
166 | try: |
|
171 | try: | |
167 | if isinstance(inst, error.SignalInterrupt): |
|
172 | if isinstance(inst, error.SignalInterrupt): |
@@ -174,7 +174,7 class SignatureError(Exception): | |||||
174 | class PushRaced(RuntimeError): |
|
174 | class PushRaced(RuntimeError): | |
175 | """An exception raised during unbundling that indicate a push race""" |
|
175 | """An exception raised during unbundling that indicate a push race""" | |
176 |
|
176 | |||
177 | class ProgrammingError(RuntimeError): |
|
177 | class ProgrammingError(Hint, RuntimeError): | |
178 | """Raised if a mercurial (core or extension) developer made a mistake""" |
|
178 | """Raised if a mercurial (core or extension) developer made a mistake""" | |
179 |
|
179 | |||
180 | # bundle2 related errors |
|
180 | # bundle2 related errors |
@@ -3,7 +3,7 | |||||
3 | > """A small extension that tests our developer warnings |
|
3 | > """A small extension that tests our developer warnings | |
4 | > """ |
|
4 | > """ | |
5 | > |
|
5 | > | |
6 | > from mercurial import registrar, repair, util |
|
6 | > from mercurial import error, registrar, repair, util | |
7 | > |
|
7 | > | |
8 | > cmdtable = {} |
|
8 | > cmdtable = {} | |
9 | > command = registrar.command(cmdtable) |
|
9 | > command = registrar.command(cmdtable) | |
@@ -61,6 +61,9 | |||||
61 | > @command('nouiwarning', [], '') |
|
61 | > @command('nouiwarning', [], '') | |
62 | > def nouiwarning(ui, repo): |
|
62 | > def nouiwarning(ui, repo): | |
63 | > util.nouideprecwarn('this is a test', '13.37') |
|
63 | > util.nouideprecwarn('this is a test', '13.37') | |
|
64 | > @command('programmingerror', [], '') | |||
|
65 | > def programmingerror(ui, repo): | |||
|
66 | > raise error.ProgrammingError('something went wrong', hint='try again') | |||
64 | > EOF |
|
67 | > EOF | |
65 |
|
68 | |||
66 | $ cat << EOF >> $HGRCPATH |
|
69 | $ cat << EOF >> $HGRCPATH | |
@@ -163,9 +166,23 Test programming error failure: | |||||
163 | ** Python * (glob) |
|
166 | ** Python * (glob) | |
164 | ** Mercurial Distributed SCM (*) (glob) |
|
167 | ** Mercurial Distributed SCM (*) (glob) | |
165 | ** Extensions loaded: * (glob) |
|
168 | ** Extensions loaded: * (glob) | |
|
169 | ** ProgrammingError: transaction requires locking | |||
166 | Traceback (most recent call last): |
|
170 | Traceback (most recent call last): | |
167 | mercurial.error.ProgrammingError: transaction requires locking |
|
171 | mercurial.error.ProgrammingError: transaction requires locking | |
168 |
|
172 | |||
|
173 | $ hg programmingerror 2>&1 | egrep -v '^ ' | |||
|
174 | ** Unknown exception encountered with possibly-broken third-party extension buggylocking | |||
|
175 | ** which supports versions unknown of Mercurial. | |||
|
176 | ** Please disable buggylocking and try your action again. | |||
|
177 | ** If that fixes the bug please report it to the extension author. | |||
|
178 | ** Python * (glob) | |||
|
179 | ** Mercurial Distributed SCM (*) (glob) | |||
|
180 | ** Extensions loaded: * (glob) | |||
|
181 | ** ProgrammingError: something went wrong | |||
|
182 | ** (try again) | |||
|
183 | Traceback (most recent call last): | |||
|
184 | mercurial.error.ProgrammingError: something went wrong | |||
|
185 | ||||
169 | Old style deprecation warning |
|
186 | Old style deprecation warning | |
170 |
|
187 | |||
171 | $ hg nouiwarning |
|
188 | $ hg nouiwarning |
General Comments 0
You need to be logged in to leave comments.
Login now