Remove CommandError usage from rbtools.utils

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

david
RBTools
release-1.0.x
7e54390...
rbtools

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.
  • 0
  • 0
  • 6
  • 0
  • 6
Description From Last Updated
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

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

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

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

    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)
     
     
     
     

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

  3. 
      
david
Review request changed

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
chipx86
  1. Ship It!
  2. 
      
Loading...