Remove CommandError usage from rbtools.utils

Review Request #9897 — Created April 30, 2018 and submitted

Information

RBTools
release-1.0.x
7e54390...

Reviewers

CommandError is intended to be used only within rbtools.commands, and
it was a layering violation to use it from util code. I've swapped out
the places that raised it to instead use other, more appropriate
exception types, and then the commands that call those APIs can catch
and handle those.

  • Tested (most of) the various error conditions that caused the problems.
  • Ran unit tests.
Description From Last Updated

F821 undefined name 'six'

reviewbotreviewbot

F821 undefined name 'six'

reviewbotreviewbot

F821 undefined name 'review_request_id'

reviewbotreviewbot

Can we use keyword arguments here, to help with readability?

chipx86chipx86

Maybe worth inversing this? if i == num_retries - 1: raise logging.error(...) Maybe getting into the weeds here, but that …

chipx86chipx86

There's no need for an else. The raise ends things for this function.

chipx86chipx86
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

david
chipx86
  1. 
      
  2. rbtools/utils/users.py (Diff revision 2)
     
     
    Show all issues

    Can we use keyword arguments here, to help with readability?

  3. rbtools/utils/users.py (Diff revision 2)
     
     
     
     
     
     
    Show all issues

    Maybe worth inversing this?

    if i == num_retries - 1:
        raise
    
    logging.error(...)
    

    Maybe getting into the weeds here, but that code actually gets nicer if we change the loop:

    for i in range(num_retries + 1):
        ...
    
        if i == num_retries:
            raise
    
        ...
    
  4. 
      
david
chipx86
  1. 
      
  2. rbtools/utils/users.py (Diff revisions 2 - 3)
     
     
     
     
    Show all issues

    There's no need for an else. The raise ends things for this function.

  3. 
      
david
chipx86
  1. Ship It!
  2. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-1.0.x (401f6ba)
Loading...