Attribute Rule error message from GeodatabaseAttributeRuleException

396
1
08-20-2018 01:54 PM
CharlieGorman
New Contributor II

Currently I am getting the generic error message "Violated attribute constraint rule" when adding a record to a Standalone Table with attribute rules through an Inspector.

Is it possible to get the specific error message of the Attribute Rule from the GeodatabaseAttributeRuleException?

Attribute Rule Exception Message

Tags (1)
0 Kudos
1 Reply
CharlieGorman
New Contributor II

Answering my own question...

Rather than create the row on the table directly, an EditOperation was used in which an Inspector was loaded with the modified values. When the EditOperation.Execute() call fails due to an Attribute Rule error, the EditOperation.ErrorMessage property is populated with the Attribute Rule error message.

CurrentEditOperation.Name = "Road Name Create";
CurrentEditOperation.Create(AttributeInspector.MapMember, AttributeInspector);

bool result = CurrentEditOperation.Execute();

if(!result)

{

   var errorMessage = CurrentEditOperation.ErrorMessage;

}

0 Kudos