##// END OF EJS Templates
api: report better error when fetching a node that doesn't exist.
marcink -
r3490:dcd7ad80 default
parent child
Show More
@@ -37,6 +37,7 from rhodecode.lib.utils2 import str2boo
37 from rhodecode.lib.ext_json import json
37 from rhodecode.lib.ext_json import json
38 from rhodecode.lib.exceptions import StatusChangeOnClosedPullRequestError
38 from rhodecode.lib.exceptions import StatusChangeOnClosedPullRequestError
39 from rhodecode.lib.vcs import RepositoryError
39 from rhodecode.lib.vcs import RepositoryError
40 from rhodecode.lib.vcs.exceptions import NodeDoesNotExistError
40 from rhodecode.model.changeset_status import ChangesetStatusModel
41 from rhodecode.model.changeset_status import ChangesetStatusModel
41 from rhodecode.model.comment import CommentsModel
42 from rhodecode.model.comment import CommentsModel
42 from rhodecode.model.db import (
43 from rhodecode.model.db import (
@@ -579,7 +580,9 def get_repo_file(request, apiuser, repo
579 node = ScmModel().get_node(
580 node = ScmModel().get_node(
580 repo, commit_id, file_path, extended_info=extended_info,
581 repo, commit_id, file_path, extended_info=extended_info,
581 content=content, max_file_bytes=max_file_bytes, cache=cache)
582 content=content, max_file_bytes=max_file_bytes, cache=cache)
582
583 except NodeDoesNotExistError:
584 raise JSONRPCError('There is no file in repo: `{}` at path `{}` for commit: `{}`'.format(
585 repo.repo_name, file_path, commit_id))
583 except Exception:
586 except Exception:
584 log.exception("Exception occurred while trying to get repo %s file",
587 log.exception("Exception occurred while trying to get repo %s file",
585 repo.repo_name)
588 repo.repo_name)
General Comments 0
You need to be logged in to leave comments. Login now