-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add exception handling to EvaluateAsync method
The EvaluateAsync method in XmlTemplateReader class has been updated to handle exceptions. A new exception called TransformationEvaluationFailedException has been introduced and will be thrown when the evaluation of a transformation expression fails during the transformation of an XML document. Adjustments were also made to the TransformationFunctionMissingClosingBracketException class.
- Loading branch information
Showing
4 changed files
with
46 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
source/X39.Solutions.PdfTemplate/Xml/Exceptions/TransformationEvaluationFailedException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace X39.Solutions.PdfTemplate.Xml.Exceptions; | ||
|
||
/// <summary> | ||
/// Thrown when the evaluation of a transformation expression fails during the transformation of an XML document. | ||
/// </summary> | ||
public sealed class TransformationEvaluationFailedException : XmlTemplateTransformationException | ||
{ | ||
/// <summary> | ||
/// Represents an expression used in XML template transformation. | ||
/// </summary> | ||
public string Expression { get; } | ||
|
||
internal TransformationEvaluationFailedException(string expression, XmlNode node, Exception exception) | ||
: base( | ||
$"Failed to evaluate expression '{expression}' at L{node.Line}:C{node.Column} with exception: {exception.Message}", | ||
exception, | ||
node | ||
) | ||
{ | ||
Expression = expression; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters