diff options
| author | Melodi <62381002+Melodi17@users.noreply.github.com> | 2026-09-13 13:22:20 +1000 |
|---|---|---|
| committer | Melodi <62381002+Melodi17@users.noreply.github.com> | 2026-09-13 13:22:20 +1000 |
| commit | df0737e55afeb5c01eb39909605970d1d3a73ffc (patch) | |
| tree | 09823eaa310c60eefd2420dc305acae45c81900f /src/marlin.core/util/VariableExpansionException.cs | |
| parent | ee69ce25b2fba871920260028bb10c2d6b62b26f (diff) | |
refactor: cleanup; feat: connection to agent
Diffstat (limited to 'src/marlin.core/util/VariableExpansionException.cs')
| -rw-r--r-- | src/marlin.core/util/VariableExpansionException.cs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/marlin.core/util/VariableExpansionException.cs b/src/marlin.core/util/VariableExpansionException.cs new file mode 100644 index 0000000..3053880 --- /dev/null +++ b/src/marlin.core/util/VariableExpansionException.cs @@ -0,0 +1,56 @@ +namespace marlin.core.util; + +/// <summary> +/// Base exception for all variable expansion errors +/// </summary> +public class VariableExpansionException(string message) : Exception(message); + +/// <summary> +/// Thrown when a variable is referenced but not found in the variables dictionary +/// </summary> +public class VariableNotFoundException : VariableExpansionException +{ + public string VariableName { get; } + + public VariableNotFoundException(string variableName) + : base($"Variable '{variableName}' not found") + { + this.VariableName = variableName; + } +} + +/// <summary> +/// Thrown when an expression has invalid syntax or cannot be parsed +/// </summary> +public class InvalidExpressionException : VariableExpansionException +{ + public string Expression { get; } + + public InvalidExpressionException(string expression) + : base($"Invalid expression '{expression}'") + { + this.Expression = expression; + } + + public InvalidExpressionException(string expression, string reason) + : base($"Invalid expression '{expression}': {reason}") + { + this.Expression = expression; + } +} + +/// <summary> +/// Thrown when braces are not properly matched or escaped +/// </summary> +public class UnmatchedBraceException : VariableExpansionException +{ + public int Position { get; } + public string Remainder { get; } + + public UnmatchedBraceException(string message, int position, string remainder) + : base(message) + { + this.Position = position; + this.Remainder = remainder; + } +} |
