more error handling and docs

This commit is contained in:
TomPallister
2020-04-13 12:46:14 +01:00
parent c9483cdad6
commit 7408060fba
18 changed files with 189 additions and 76 deletions

View File

@ -48,6 +48,7 @@ namespace Ocelot.UnitTests.Responder
[Theory]
[InlineData(OcelotErrorCode.UnableToCompleteRequestError)]
[InlineData(OcelotErrorCode.CouldNotFindLoadBalancerCreator)]
[InlineData(OcelotErrorCode.ErrorInvokingLoadBalancerCreator)]
public void should_return_internal_server_error(OcelotErrorCode errorCode)
{
ShouldMapErrorToStatusCode(errorCode, HttpStatusCode.InternalServerError);
@ -133,7 +134,7 @@ namespace Ocelot.UnitTests.Responder
// If this test fails then it's because the number of error codes has changed.
// You should make the appropriate changes to the test cases here to ensure
// they cover all the error codes, and then modify this assertion.
Enum.GetNames(typeof(OcelotErrorCode)).Length.ShouldBe(40, "Looks like the number of error codes has changed. Do you need to modify ErrorsToHttpStatusCodeMapper?");
Enum.GetNames(typeof(OcelotErrorCode)).Length.ShouldBe(41, "Looks like the number of error codes has changed. Do you need to modify ErrorsToHttpStatusCodeMapper?");
}
private void ShouldMapErrorToStatusCode(OcelotErrorCode errorCode, HttpStatusCode expectedHttpStatusCode)