Skip to main content

Add an error to a model

To add an error to a model, use the AddError method of the IModel object.

Add an error

The AddError method of the IModel object is defined as follows. Call it for the model for which you want to register an error.

IError IModel.AddError(string fields, string type, string title, string message); 
  • fields: Name of the field that caused the error
  • type: "Information", "Warning", "Error", "Summary"
  • title: Title of the error
  • message: Error message

You can enter null for the field name that caused the error, in which case it will be registered as an error for the model (no error detection field). The error will be added to the model in the following display depending on the error type you set.

Information

Warning

Error

Summary

tip

Unlike other error formats, the number of errors is not accumulated in the navigator.

Example

Call as follows:

public void AddError(ICommandContext c, ICommandParams p) 
{
IModel model = c.App.Workspace.CurrentModel;
model.AddError("UseCases", "Error", "Error title", "Error message");
}