##// END OF EJS Templates
hovercards: handle unknown commits on repo by returning 404 instead of 500 error.
marcink -
r4110:15b821fa default
parent child Browse files
Show More
@@ -22,6 +22,7 b' import re'
22 22 import logging
23 23 import collections
24 24
25 from pyramid.httpexceptions import HTTPNotFound
25 26 from pyramid.view import view_config
26 27
27 28 from rhodecode.apps._base import BaseAppView, RepoAppView
@@ -33,6 +34,7 b' from rhodecode.lib.codeblocks import fil'
33 34 from rhodecode.lib.index import searcher_from_config
34 35 from rhodecode.lib.utils2 import safe_unicode, str2bool, safe_int
35 36 from rhodecode.lib.ext_json import json
37 from rhodecode.lib.vcs.exceptions import CommitDoesNotExistError
36 38 from rhodecode.lib.vcs.nodes import FileNode
37 39 from rhodecode.model.db import (
38 40 func, true, or_, case, in_filter_generator, Repository, RepoGroup, User, UserGroup, PullRequest)
@@ -99,5 +101,9 b' class HoverCardsRepoView(RepoAppView):'
99 101 c = self.load_default_context()
100 102 commit_id = self.request.matchdict['commit_id']
101 103 pre_load = ['author', 'branch', 'date', 'message']
104 try:
102 105 c.commit = self.rhodecode_vcs_repo.get_commit(commit_id=commit_id, pre_load=pre_load)
106 except CommitDoesNotExistError:
107 raise HTTPNotFound()
108
103 109 return self._get_template_context(c)
General Comments 0
You need to be logged in to leave comments. Login now