diff --git a/src/pkg/services/m365/api/graph/errors.go b/src/pkg/services/m365/api/graph/errors.go index 00dcf5c9d..5a16fd146 100644 --- a/src/pkg/services/m365/api/graph/errors.go +++ b/src/pkg/services/m365/api/graph/errors.go @@ -243,6 +243,11 @@ func IsErrItemAlreadyExistsConflict(err error) bool { parseODataErr(err).hasErrorCode(err, nameAlreadyExists) } +func IsErrNameAlreadyExistsConflict(err error) bool { + return errors.Is(err, ErrNameAlreadyExistsConflict) || + parseODataErr(err).hasErrorCode(err, nameAlreadyExists) +} + // LabelStatus transforms the provided statusCode into // a standard label that can be attached to a clues error // and later reviewed when checking error statuses. diff --git a/src/pkg/services/m365/api/lists_test.go b/src/pkg/services/m365/api/lists_test.go index 8f8d80006..bc4bdcf40 100644 --- a/src/pkg/services/m365/api/lists_test.go +++ b/src/pkg/services/m365/api/lists_test.go @@ -758,7 +758,7 @@ func (suite *ListsAPIIntgSuite) TestLists_PostList() { _, err = acl.PostList(ctx, siteID, listName, oldListByteArray, fault.New(true)) require.Error(t, err) - assert.Equal(t, graph.ErrNameAlreadyExistsConflict, err) + assert.True(t, graph.IsErrNameAlreadyExistsConflict(err)) newListItems := newList.GetItems() require.Less(t, 0, len(newListItems))