Skip to main content

Clear errors

To clear all current errors, call the ClearErrors method of the IErrors object. To get an IErrors object, use the Errors property of the IApplication object.

public void ClearErrors(ICommandContext c, ICommandParams p) 
{
//Clear all errors
c.App.Errors.ClearErrors();
}

To clear only errors for a specific model, call the ClearErrorsAt method of the IErrors object.

public void ClearError(ICommandContext c, ICommandParams p) 
{
//Get the target model
var model = c.App.Workspace.CurrentModel;

//Clear the errors in the target model
c.App.Errors.ClearErrorsAt(model);
}