protected async Task<ErrorHandleResult> HandleError(Message message, Dictionary<string, string> headers, Exception exception, TransportTransaction transportTransaction, int processingAttempts)
{
try
{
var body = await ReadStream(message.BodyStream).ConfigureAwait(false);
var errorContext = new ErrorContext(exception, headers, message.Id, body, transportTransaction, processingAttempts);
return await onError(errorContext).ConfigureAwait(false);
}
catch (Exception ex)
{
criticalError.Raise($"Failed to execute recoverability actions for message `{message.Id}`", ex);
//best thing we can do is roll the message back if possible
return ErrorHandleResult.RetryRequired;
}
}