Path: redb-route/redb.Route.Templates/TemplateCompilationException.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Templates/TemplateCompilationException.cs
----
namespace redb.Route.Templates;
///
/// A template could not be read or parsed. Raised while the route is compiled, so it surfaces from
/// RouteContext.Start() with the template name and the first error's line and column.
///
public sealed class TemplateCompilationException : Exception
{
/// Creates the exception.
public TemplateCompilationException(string templateName, int? line, int? column, string message, Exception? inner = null)
: base(Format(templateName, line, column, message), inner)
{
TemplateName = templateName;
Line = line;
Column = column;
}
/// Template name as given in the DSL / XML (file path, resource locator, or <inline>).
public string TemplateName { get; }
/// 1-based line of the first error, when known.
public int? Line { get; }
/// 1-based column of the first error, when known.
public int? Column { get; }
private static string Format(string name, int? line, int? column, string message)
=> line is null
? $"Template '{name}': {message}"
: $"Template '{name}' ({line},{column}): {message}";
}