ApiError error message if 'code' argument left out, becomes a redundant error

Bug #752818 reported by John Tran
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
John Tran

Bug Description

"ApiError: ApiError: Image must be available" is the output if :
    raise exception.ApiError(_('Image must be available'))$

Apparently, the code expects this behavior:

class ApiError(Error):$
    def __init__(self, message='Unknown', code='ApiError'):$
    ...
    super(ApiError, self).__init__('%s: %s' % (code, message))

The output thus becomes redundant and at first glance, I thought I accidentally nested the exception to cause it to repeat itself.

If the 'code' arg is left undefined, the output message should not specify a 'code' portion of the string at all. It should then output something like this instead:

"ApiError: Image must be available"

Related branches

John Tran (jtran)
Changed in nova:
assignee: nobody → John Tran (jtran)
John Tran (jtran)
Changed in nova:
status: New → In Progress
John Tran (jtran)
Changed in nova:
status: In Progress → Fix Committed
John Tran (jtran)
Changed in nova:
status: Fix Committed → In Progress
Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Low
John Tran (jtran)
Changed in nova:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.