AssertionError: Bad state transition from EXPIRED to DEACTIVATED

Bug #641266 reported by Curtis Hovey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
j.c.sackett

Bug Description

OOPS-1720EC636 is a bad API request. The AssertionError should be exported so that the user knows why his script is bad.

Related branches

Revision history for this message
Curtis Hovey (sinzui) wrote :

There are two assertions. I think we want to revise the code to explicitly raise an ValueError type because the status is not valid for the current state. We wrap the error in expose() so that the API user can see the message. This might be the way to do this.

lp.registry.errors:
from lazr.restful.declarations import webservice_error
class TeamMembershipTransitionError(ValueError):
    # HTTP Error: 'Not acceptable'
    webservice_error(406)

lp.registry.model.teammembership:
from lazr.restful.error import expose

        if self.status not in state_transition:
            raise expose(TeamMembershipTransitionError(
                "Unknown status: %s" % self.status.name))
        if status not in state_transition[self.status]:
            raise expose(TeamMembershipTransitionError(
                "Bad state transition from %s to %s"
                % (self.status.name, status.name))

Curtis Hovey (sinzui)
Changed in launchpad-registry:
milestone: series-future → 10.10
j.c.sackett (jcsackett)
Changed in launchpad-registry:
assignee: nobody → j.c.sackett (jcsackett)
status: Triaged → In Progress
Revision history for this message
Launchpad QA Bot (lpqabot) wrote : Bug fixed by a commit
tags: added: qa-needstesting
Changed in launchpad-registry:
status: In Progress → Fix Committed
j.c.sackett (jcsackett)
tags: added: qa-ok
removed: qa-needstesting
Curtis Hovey (sinzui)
Changed in launchpad-registry:
status: Fix Committed → 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.