mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 06:22:50 +08:00
Merge branch 'catcherwong-fix-1045' into develop
This commit is contained in:
commit
81c81b5a48
@ -1,6 +1,6 @@
|
|||||||
namespace Ocelot.Requester
|
namespace Ocelot.Requester
|
||||||
{
|
{
|
||||||
using Errors;
|
using Ocelot.Errors;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -23,7 +23,7 @@ namespace Ocelot.Requester
|
|||||||
return _mappers[type](exception);
|
return _mappers[type](exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == typeof(OperationCanceledException))
|
if (type == typeof(OperationCanceledException) || type.IsSubclassOf(typeof(OperationCanceledException)))
|
||||||
{
|
{
|
||||||
return new RequestCanceledError(exception.Message);
|
return new RequestCanceledError(exception.Message);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,14 @@
|
|||||||
error.ShouldBeOfType<RequestCanceledError>();
|
error.ShouldBeOfType<RequestCanceledError>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void should_return_request_canceled_for_subtype()
|
||||||
|
{
|
||||||
|
var error = _mapper.Map(new SomeException());
|
||||||
|
|
||||||
|
error.ShouldBeOfType<RequestCanceledError>();
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void should_return_error_from_mapper()
|
public void should_return_error_from_mapper()
|
||||||
{
|
{
|
||||||
@ -56,5 +64,8 @@
|
|||||||
|
|
||||||
error.ShouldBeOfType<AnyError>();
|
error.ShouldBeOfType<AnyError>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class SomeException : OperationCanceledException
|
||||||
|
{ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user