From f679e29a0c74408a5e064b0071afe5ae6a6ee597 Mon Sep 17 00:00:00 2001 From: Felipe Cotti Date: Mon, 24 Nov 2025 15:27:08 -0300 Subject: [PATCH 1/3] Properly register an error upon being unable to resolve the URI --- .../Building/AssemblerBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuilder.cs b/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuilder.cs index d3218331f..8aaaa1297 100644 --- a/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuilder.cs +++ b/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuilder.cs @@ -116,7 +116,7 @@ string Resolve(string path) if (Uri.IsWellFormedUriString(path, UriKind.Absolute)) // Cross-repo links { _ = linkResolver.TryResolve( - e => _logger.LogError("An error occurred while resolving cross-link {Path}: {Error}", path, e), + e => context.Collector.EmitError(path, $"An error occurred while resolving cross-link {path}: {e}", null), new Uri(path), out uri); } From 66dd52fa83cf15639dbff7a3c37cde89bc8a989c Mon Sep 17 00:00:00 2001 From: Felipe Cotti Date: Wed, 26 Nov 2025 11:00:36 -0300 Subject: [PATCH 2/3] Update src/services/Elastic.Documentation.Assembler/Building/AssemblerBuilder.cs Co-authored-by: Jan Calanog --- .../Building/AssemblerBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuilder.cs b/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuilder.cs index 8aaaa1297..1d0f06400 100644 --- a/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuilder.cs +++ b/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuilder.cs @@ -116,7 +116,7 @@ string Resolve(string path) if (Uri.IsWellFormedUriString(path, UriKind.Absolute)) // Cross-repo links { _ = linkResolver.TryResolve( - e => context.Collector.EmitError(path, $"An error occurred while resolving cross-link {path}: {e}", null), + e => context.Collector.EmitError(path, $"An error occurred while resolving cross-link {path}", e), new Uri(path), out uri); } From 19a3ea20639ee1d5aef60034854d300f68ac425f Mon Sep 17 00:00:00 2001 From: Felipe Cotti Date: Wed, 26 Nov 2025 13:13:29 -0300 Subject: [PATCH 3/3] Add overload to EmitError to simplify adding an error message without accompanying Exception --- src/Elastic.Documentation/Diagnostics/DiagnosticsCollector.cs | 2 ++ src/Elastic.Documentation/Diagnostics/IDiagnosticsCollector.cs | 1 + .../Building/AssemblerBuilder.cs | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Elastic.Documentation/Diagnostics/DiagnosticsCollector.cs b/src/Elastic.Documentation/Diagnostics/DiagnosticsCollector.cs index 5207c58c6..ec3fc38f3 100644 --- a/src/Elastic.Documentation/Diagnostics/DiagnosticsCollector.cs +++ b/src/Elastic.Documentation/Diagnostics/DiagnosticsCollector.cs @@ -111,6 +111,8 @@ public void Emit(Severity severity, string file, string message) => Message = message }); + public void EmitError(string file, string message, string specificErrorMessage) => Emit(Severity.Error, file, $"{message}{Environment.NewLine}{specificErrorMessage}"); + public void EmitError(string file, string message, Exception? e = null) { message = message diff --git a/src/Elastic.Documentation/Diagnostics/IDiagnosticsCollector.cs b/src/Elastic.Documentation/Diagnostics/IDiagnosticsCollector.cs index 6e2c2c361..6e804ad76 100644 --- a/src/Elastic.Documentation/Diagnostics/IDiagnosticsCollector.cs +++ b/src/Elastic.Documentation/Diagnostics/IDiagnosticsCollector.cs @@ -23,6 +23,7 @@ public interface IDiagnosticsCollector : IAsyncDisposable, IHostedService void Emit(Severity severity, string file, string message); void EmitError(string file, string message, Exception? e = null); + void EmitError(string file, string message, string specificErrorMessage); void EmitWarning(string file, string message); void EmitHint(string file, string message); void Write(Diagnostic diagnostic); diff --git a/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuilder.cs b/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuilder.cs index 1d0f06400..a6410ffbf 100644 --- a/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuilder.cs +++ b/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuilder.cs @@ -116,7 +116,7 @@ string Resolve(string path) if (Uri.IsWellFormedUriString(path, UriKind.Absolute)) // Cross-repo links { _ = linkResolver.TryResolve( - e => context.Collector.EmitError(path, $"An error occurred while resolving cross-link {path}", e), + specificErrorMessage => context.Collector.EmitError(path, $"An error occurred while resolving cross-link {path}", specificErrorMessage), new Uri(path), out uri); }