##// END OF EJS Templates
exceptions: don't report lookup errors as exceptions stored in the exception store....
marcink -
r843:d6e71ccf default
parent child Browse files
Show More
@@ -115,3 +115,7 b' class HTTPRepoLocked(HTTPLocked):'
115 115 class HTTPRepoBranchProtected(HTTPForbidden):
116 116 def __init__(self, *args, **kwargs):
117 117 super(HTTPForbidden, self).__init__(*args, **kwargs)
118
119
120 class RefNotFoundException(KeyError):
121 pass
@@ -697,7 +697,12 b' class GitRemote(RemoteBase):'
697 697 missing_commit_err = 'Commit {} does not exist for `{}`'.format(sha, wire['path'])
698 698 try:
699 699 commit = repo.revparse_single(sha)
700 except (KeyError, ValueError) as e:
700 except KeyError:
701 # NOTE(marcink): KeyError doesn't give us any meaningful information
702 # here, we instead give something more explicit
703 e = exceptions.RefNotFoundException('SHA: %s not found', sha)
704 raise exceptions.LookupException(e)(missing_commit_err)
705 except ValueError as e:
701 706 raise exceptions.LookupException(e)(missing_commit_err)
702 707
703 708 is_tag = False
@@ -719,7 +724,10 b' class GitRemote(RemoteBase):'
719 724 if branch:
720 725 break
721 726 else:
722 raise exceptions.LookupException(None)(missing_commit_err)
727 # NOTE(marcink): Empty error doesn't give us any meaningful information
728 # here, we instead give something more explicit
729 e = exceptions.RefNotFoundException('SHA: %s not found in branches', sha)
730 raise exceptions.LookupException(e)(missing_commit_err)
723 731
724 732 commit_id = commit.hex
725 733 type_id = commit.type
@@ -404,6 +404,19 b' class HTTPApplication(object):'
404 404 exc_info[0] = org_exc.__class__
405 405 exc_info[1] = org_exc
406 406
407 should_store_exc = True
408 if org_exc:
409 def get_exc_fqn(_exc_obj):
410 module_name = getattr(org_exc.__class__, '__module__', 'UNKNOWN')
411 return module_name + '.' + org_exc_name
412
413 exc_fqn = get_exc_fqn(org_exc)
414
415 if exc_fqn in ['mercurial.error.RepoLookupError',
416 'vcsserver.exceptions.RefNotFoundException']:
417 should_store_exc = False
418
419 if should_store_exc:
407 420 store_exception(id(exc_info), exc_info)
408 421
409 422 tb_info = ''.join(
General Comments 0
You need to be logged in to leave comments. Login now