Selaa lähdekoodia

Fix null reference in AmazonSQSTransport (#846)

Co-authored-by: Andrii Labyntsev <lab.andrii@gmail.com>
master
Andrii Labyntsev 3 vuotta sitten
committed by GitHub
vanhempi
commit
d224abbdc2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 muutettua tiedostoa jossa 11 lisäystä ja 17 poistoa
  1. +10
    -6
      src/DotNetCore.CAP.AmazonSQS/ITransport.AmazonSQS.cs
  2. +1
    -11
      src/DotNetCore.CAP/OperateResult.cs

+ 10
- 6
src/DotNetCore.CAP.AmazonSQS/ITransport.AmazonSQS.cs Näytä tiedosto

@@ -65,12 +65,16 @@ namespace DotNetCore.CAP.AmazonSQS
return OperateResult.Success;
}

_logger.LogWarning($"Can't be found SNS topics for [{message.GetName().NormalizeForAws()}]");
return OperateResult.Failed(new OperateError
{
Code = "SNS",
Description = $"Can't be found SNS topics for [{message.GetName().NormalizeForAws()}]"
});
var errorMessage = $"Can't be found SNS topics for [{message.GetName().NormalizeForAws()}]";
_logger.LogWarning(errorMessage);

return OperateResult.Failed(
new PublisherSentFailedException(errorMessage),
new OperateError
{
Code = "SNS",
Description = $"Can't be found SNS topics for [{message.GetName().NormalizeForAws()}]"
});
}
catch (Exception ex)
{


+ 1
- 11
src/DotNetCore.CAP/OperateResult.cs Näytä tiedosto

@@ -41,22 +41,12 @@ namespace DotNetCore.CAP
/// Creates an <see cref="OperateResult" /> indicating a failed operation, with a list of <paramref name="errors" /> if
/// applicable.
/// </summary>
/// <param name="ex">Operate Result exception</param>
/// <param name="errors">An optional array of <see cref="OperateError" />s which caused the operation to fail.</param>
/// <returns>
/// An <see cref="OperateResult" /> indicating a failed operation, with a list of <paramref name="errors" /> if
/// applicable.
/// </returns>
public static OperateResult Failed(params OperateError[] errors)
{
var result = new OperateResult {Succeeded = false};
if (errors != null)
{
result._errors.AddRange(errors);
}

return result;
}

public static OperateResult Failed(Exception ex, params OperateError[] errors)
{
var result = new OperateResult


Ladataan…
Peruuta
Tallenna