diff --git a/sdk/eventhub/Azure.Messaging.EventHubs.Processor/CHANGELOG.md b/sdk/eventhub/Azure.Messaging.EventHubs.Processor/CHANGELOG.md
index 6b994baf5b230..0bf75153ef474 100755
--- a/sdk/eventhub/Azure.Messaging.EventHubs.Processor/CHANGELOG.md
+++ b/sdk/eventhub/Azure.Messaging.EventHubs.Processor/CHANGELOG.md
@@ -12,6 +12,8 @@
### Other Changes
+- Calling `ToString` on an `EventHubsException` now includes details of any inner exception.
+
## 5.7.5 (2022-11-22)
### Bugs Fixed
diff --git a/sdk/eventhub/Azure.Messaging.EventHubs/CHANGELOG.md b/sdk/eventhub/Azure.Messaging.EventHubs/CHANGELOG.md
index 5c887e69d98eb..184adedff75c0 100755
--- a/sdk/eventhub/Azure.Messaging.EventHubs/CHANGELOG.md
+++ b/sdk/eventhub/Azure.Messaging.EventHubs/CHANGELOG.md
@@ -12,6 +12,8 @@
### Other Changes
+- Calling `ToString` on an `EventHubsException` now includes details of any inner exception.
+
## 5.7.5 (2022-11-22)
### Acknowledgments
diff --git a/sdk/eventhub/Azure.Messaging.EventHubs/src/EventHubsException.cs b/sdk/eventhub/Azure.Messaging.EventHubs/src/EventHubsException.cs
index 74517e348177e..6247d9bc558b2 100644
--- a/sdk/eventhub/Azure.Messaging.EventHubs/src/EventHubsException.cs
+++ b/sdk/eventhub/Azure.Messaging.EventHubs/src/EventHubsException.cs
@@ -201,7 +201,17 @@ internal EventHubsException(string eventHubName,
/// A that represents this instance.
///
public override string ToString() =>
- $"{ typeof(EventHubsException).FullName }({ Reason }): { Message }{ Environment.NewLine }{ StackTrace }";
+ $"{ typeof(EventHubsException).FullName }({ Reason }): { Message }{ Environment.NewLine }{ StackTrace }{ FormatInnerException() }";
+
+ ///
+ /// Formats the for inclusion in the
+ /// details.
+ ///
+ ///
+ /// The text to include for the inner exception, if any.
+ ///
+ private string FormatInnerException() =>
+ (InnerException == null) ? string.Empty : $"{ Environment.NewLine }{ InnerException }";
///
/// The set of well-known reasons for an Event Hubs operation failure that
diff --git a/sdk/eventhub/Azure.Messaging.EventHubs/src/Processor/ProcessErrorEventArgs.cs b/sdk/eventhub/Azure.Messaging.EventHubs/src/Processor/ProcessErrorEventArgs.cs
index 432578ddaacbb..f8faff87de598 100644
--- a/sdk/eventhub/Azure.Messaging.EventHubs/src/Processor/ProcessErrorEventArgs.cs
+++ b/sdk/eventhub/Azure.Messaging.EventHubs/src/Processor/ProcessErrorEventArgs.cs
@@ -8,8 +8,8 @@
namespace Azure.Messaging.EventHubs.Processor
{
///
- /// Contains information about a partition whose processing surfaced an exception, as well as
- /// the exception that occurred.
+ /// Contains information about an exception that occurred within the processor, whether for a specific partition
+ /// or as part of the processor's internal operations.
///
///
/// Azure.Messaging.EventHubs.Processor (NuGet)
@@ -17,7 +17,8 @@ namespace Azure.Messaging.EventHubs.Processor
public struct ProcessErrorEventArgs
{
///
- /// The identifier of the partition being processed when the exception occurred.
+ /// The identifier of the partition being processed when the exception occurred. If the exception did
+ /// not occur for a specific partition, this value will be null.
///
///
public string PartitionId { get; }
@@ -29,7 +30,7 @@ public struct ProcessErrorEventArgs
public string Operation { get; }
///
- /// The exception that was occurred during partition processing.
+ /// The exception that was occurred during processing.
///
///
public Exception Exception { get; }
diff --git a/sdk/eventhub/Azure.Messaging.EventHubs/tests/Errors/EventHubsExceptionTests.cs b/sdk/eventhub/Azure.Messaging.EventHubs/tests/Errors/EventHubsExceptionTests.cs
index f6661ee391623..12f13ffa5a698 100644
--- a/sdk/eventhub/Azure.Messaging.EventHubs/tests/Errors/EventHubsExceptionTests.cs
+++ b/sdk/eventhub/Azure.Messaging.EventHubs/tests/Errors/EventHubsExceptionTests.cs
@@ -205,5 +205,32 @@ public void ToStringContainsExceptionDetails()
Assert.That(exceptionString, Contains.Substring(eventHubName), "The ToString value should contain the Event Hub name.");
Assert.That(exceptionString, Contains.Substring($"{ Environment.NewLine }{ instance.StackTrace }"), "The ToString value should contain the stack trace on a new line.");
}
+
+ ///
+ /// Verifies functionality of the
+ /// method.
+ ///
+ ///
+ [Test]
+ public void ToStringContainsInnerExceptionDetails()
+ {
+ var message = "Inner message!";
+ var innerException = new DivideByZeroException(message);
+
+ EventHubsException instance;
+
+ try
+ {
+ throw new EventHubsException(false, "hub", "Outer", EventHubsException.FailureReason.QuotaExceeded, innerException);
+ }
+ catch (EventHubsException ex)
+ {
+ instance = ex;
+ }
+
+ var exceptionString = instance.ToString();
+ Assert.That(exceptionString, Is.Not.Null.And.Not.Empty, "The ToString value should be populated.");
+ Assert.That(exceptionString, Contains.Substring(innerException.ToString()), "The ToString value should contain the full set of details for the inner exception.");
+ }
}
}