diff --git a/AaruConsole.cs b/AaruConsole.cs
index b7ad8a6..d57bd88 100644
--- a/AaruConsole.cs
+++ b/AaruConsole.cs
@@ -30,6 +30,7 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
+using System;
using System.Diagnostics.CodeAnalysis;
namespace Aaru.Console;
@@ -107,6 +108,12 @@ public delegate void DebugWriteHandler(string format, params object[] arg);
/// An array of objects to write using .
public delegate void DebugWithModuleWriteLineHandler(string module, string format, params object[] arg);
+///
+/// Writes the exception to the debug output console.
+///
+/// Exception.
+public delegate void WriteExceptionHandler(Exception ex);
+
///
/// Implements a console abstraction that defines four level of messages that can be routed to different consoles:
/// standard, error, verbose and debug.
@@ -141,6 +148,9 @@ public static class AaruConsole
/// Event to receive writings to the debug output console.
public static event DebugWriteHandler DebugWriteEvent;
+ /// Event to receive exceptions to write to the debug output console.
+ public static event WriteExceptionHandler WriteExceptionEvent;
+
///
/// Writes the text representation of the specified array of objects, followed by the current line terminator, to
/// the standard output console using the specified format information.
@@ -242,4 +252,11 @@ public static class AaruConsole
/// The value to write.
public static void DebugWriteLine(string module, string value) =>
DebugWriteLineEvent?.Invoke("{0}", "DEBUG (" + module + "): " + value);
+
+ ///
+ /// Writes the exception to the debug output console.
+ ///
+ /// Exception.
+ public static void WriteException(Exception ex) =>
+ WriteExceptionEvent?.Invoke(ex);
}
\ No newline at end of file