@ -115,12 +115,12 @@ func (r *Repository) CreateSession(ctx context.Context, sessionWrapper wrapping.
if foundStates , err = fetchStates ( ctx , read , returnedSession . PublicId ) ; err != nil {
return errors . Wrap ( ctx , err , op )
}
if len ( foundStates ) != 1 {
return errors . New ( ctx , errors . MultipleRecords , op , fmt . Sprintf ( "%d states found for new session %s" , len ( foundStates ) , returnedSession . PublicId ) )
}
if len ( foundStates ) == 0 {
return errors . New ( ctx , errors . SessionNotFound , op , fmt . Sprintf ( "no states found for new session %s" , returnedSession . PublicId ) )
}
if len ( foundStates ) != 1 {
return errors . New ( ctx , errors . MultipleRecords , op , fmt . Sprintf ( "%d states found for new session %s" , len ( foundStates ) , returnedSession . PublicId ) )
}
returnedSession . States = foundStates
if returnedSession . States [ 0 ] . Status != StatusPending {
return errors . New ( ctx , errors . InvalidSessionState , op , fmt . Sprintf ( "new session %s state is not valid: %s" , returnedSession . PublicId , returnedSession . States [ 0 ] . Status ) )