Closed eric-millin closed 10 months ago
You can see when using a debugger to step through this code
func TestGetResponseByIdFailedRequest(t *testing.T) { errorMapping := abstractions.ErrorMappings{ "4XX": internal.CreateSampleErrorFromDiscriminatorValue, "5XX": internal.CreateSampleErrorFromDiscriminatorValue, } err := RegisterError("Userable", errorMapping) require.NoError(t, err) mockServer := makeMockRequest(200, getDummyJSON()) defer mockServer.Close() mockPath := mockServer.URL + "/$batch" reqAdapter.SetBaseUrl(mockPath) reqInfo := getRequestInfo() batch := NewBatchRequest(reqAdapter) _, err = batch.AddBatchRequestStep(*reqInfo) require.NoError(t, err) resp, err := batch.Send(context.Background(), reqAdapter) require.NoError(t, err) }
Change the following line: https://github.com/microsoftgraph/msgraph-sdk-go-core/blob/main/batch_requests.go#L269 to
return res, throwErrors(item, reflect.TypeOf(new(T)).Elem().Name())
and you'll see that the error factories are returned.
You can see when using a debugger to step through this code
Change the following line: https://github.com/microsoftgraph/msgraph-sdk-go-core/blob/main/batch_requests.go#L269 to
and you'll see that the error factories are returned.