Revision 2ff0b7bd

b/kamaki/cli/utils.py
32 32
# or implied, of GRNET S.A.
33 33

  
34 34
from re import compile as regex_compile
35
from .errors import CLIError
35
from kamaki.cli.errors import raiseCLIError
36 36

  
37 37
try:
38 38
    from colors import magenta, red, yellow, bold
......
70 70

  
71 71
def print_dict(d, exclude=(), ident=0):
72 72
    if not isinstance(d, dict):
73
        raise CLIError(message='Cannot dict_print a non-dict object')
73
        raiseCLIError(TypeError('Cannot dict_print a non-dict object'))
74 74

  
75 75
    if d:
76 76
        margin = max(len(unicode(key).strip())\
......
95 95

  
96 96
def print_list(l, exclude=(), ident=0):
97 97
    if not isinstance(l, list):
98
        raise CLIError(message='Cannot list_print a non-list object')
98
        raiseCLIError(TypeError('Cannot list_print a non-list object'))
99 99

  
100 100
    if l:
101 101
        margin = max(len(unicode(item).strip())\
......
129 129
    units = ('B', 'K', 'M', 'G', 'T')
130 130
    try:
131 131
        size = float(size)
132
    except ValueError:
133
        raise CLIError(message='Cannot format %s in bytes' % size)
132
    except ValueError as err:
133
        raiseCLIError(err, 'Cannot format %s in bytes' % size)
134 134
    for unit in units:
135 135
        if size < 1024:
136 136
            break

Also available in: Unified diff