Added exception handling for unknown transitions.