Error Handling

As of R3 2021 the RadExpressionEditor exposes an ExpressionError event which is fired when an error occurs while parsing an expression. In addition, an Errors property was introduced which holds a collection of the errors from a failed parsing operation.

Example 1: Handling the ExpressionError event

this.expressionEditor.ExpressionError += (s, e) => 
{ 
    var errors = string.Join("\n", this.expressionEditor.Errors.Select(er => er.Message)); 
 
    // display the errors to the user 
}; 
The Errors collection holds instances of the ExpressionParserError class which exposes the following members:
  • Start: The start location of the error message. It is of type ExpressionLocation and holds the line and column where the errors starts.
  • End: The end location of the error message. It is of type ExpressionLocation and holds the line and column where the errors ends.
  • Message: The error message.

You can use this information to present the errors in a user-friendly manner.

See also

In this article
Not finding the help you need? Improve this article