3687: rbt - helpful error message when repository cannot be found

ja***@jasonan******** (Google Code) (Is this you? Claim this profile.)
May 17, 2015
What version are you running?
RBTools 0.6.1; ReviewBoard 1.7.14 (but the latter shouldn't matter)

What's the URL of the page containing the problem?
None - RBTools

What steps will reproduce the problem?
1. Attempt to post a review for a repository that can't be found using `rbt post`
2. Get relatively cryptic error:
ERROR: Error getting review requests for user jantman: One or more fields had errors (HTTP 400, API Error 105)

    repository: 'None' is not an integer

What is the expected output? What do you see instead?
I'd like a helpful error message.
>>> Making HTTP GET request to http://reviews.ddtc.cmgdigital.com/api/repositories/
>>> Making HTTP GET request to http://reviews.ddtc.cmgdigital.com/api/repositories/?max-results=25&start=25
>>> Making HTTP GET request to http://reviews.ddtc.cmgdigital.com/api/repositories/?max-results=25&start=50
>>> Making HTTP GET request to http://reviews.ddtc.cmgdigital.com/api/repositories/?max-results=25&start=75
>>> Making HTTP GET request to http://reviews.ddtc.cmgdigital.com/api/repositories/?max-results=25&start=100
>>> Making HTTP GET request to http://reviews.ddtc.cmgdigital.com/api/repositories/?max-results=25&start=125
>>> Making HTTP GET request to http://reviews.ddtc.cmgdigital.com/api/review-requests/?status=pending&expand=draft&repository=None&from-user=jantman
>>> Got API Error 105 (HTTP code 400): One or more fields had errors
>>> Error data: {u'fields': {u'repository': [u"'None' is not an integer"]}, u'stat': u'fail', u'err': {u'msg': u'One or more fields had errors', u'code': 105}}
Traceback (most recent call last):
  File "/usr/bin/rbt", line 9, in <module>
    load_entry_point('RBTools==0.6.3', 'console_scripts', 'rbt')()
  File "/usr/lib/python2.7/site-packages/rbtools/commands/main.py", line 134, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "/usr/lib/python2.7/site-packages/rbtools/commands/__init__.py", line 416, in run_from_argv
    exit_code = self.main(*args) or 0
  File "/usr/lib/python2.7/site-packages/rbtools/commands/post.py", line 769, in main
    repository_info, api_root, api_client)
  File "/usr/lib/python2.7/site-packages/rbtools/commands/post.py", line 411, in guess_existing_review_request_id
    '%s: %s' % (user.username, e))
rbtools.commands.CommandError: Error getting review requests for user jantman: One or more fields had errors (HTTP 400, API Error 105)

    repository: 'None' is not an integer

I'd like rbt to detect that the repository is 'None', and instead of trying the GET with "repository=None", it should print a human-readable error message stating that the repository cannot be found.
david
#1 david
  • +EasyFix
    +Component-RBTools
#2 tien*****@gmai***** (Google Code) (Is this you? Claim this profile.)
Is this achieved by doing something like this?

rbt post --repository "Does not exist"
david
#3 david
I think you can just do it by posting to a server that does not have your current repository added. For example, if you were inside the rbtools checkout, and you were running a reviewboard devserver, rbt post --server=http://localhost:8080
#4 ja***@jasonan******** (Google Code) (Is this you? Claim this profile.)
Yes, #3 should reproduce it, or using a different origin URL (i.e. if reviewboard is configured with an origin of ssh://myserver.mydomain.com/git-repos/foo.git but your local git clone is of ssh://myserver/git-repos/foo.git
chipx86
#5 chipx86
Can you share the .reviewboardrc file?
  • +NeedInfo
david
#6 david
Fixed in release-0.7.x (8a7c19d). Thanks!
  • -NeedInfo
    +Fixed