Hello all.
I have a problem: I try to throw exception in my pre-create plugin, but it don't show in message window after save and go only in trace journal, and in journal it is unhandled.
Example of code:
public class PreUpdatePepperValidationPlugin : IPlugin { void IPlugin.Execute(IServiceProvider serviceProvider) { try { IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); var pepper = (Entity)context.InputParameters["Target"]; var i = 0; if (pepper.Attributes.Contains("new_breeder_name")) { if (string.IsNullOrWhiteSpace(pepper.GetAttributeValue("new_breeder_name"))) { throw new InvalidPluginExecutionException("messageA"); } } if (pepper.Attributes.Contains("new_breeder_surname")) { if (string.IsNullOrWhiteSpace(pepper.GetAttributeValue("new_breeder_surname"))) { throw new InvalidPluginExecutionException("message b"); } } i = 0; var img = context.PreEntityImages["UpdatePepperPreImage"]; if (pepper.Attributes.Contains("new_spice")) { var new_spice = pepper.GetAttributeValue("new_spice"); if (new_spice < 0) { throw new InvalidPluginExecutionException("less zero ex"); } if (new_spice < img.GetAttributeValue("new_spice")) { throw new InvalidPluginExecutionException("less pre ex"); } } } catch (InvalidPluginExecutionException e) { throw e; } catch (Exception e) { throw e; } } }
P. S. Sorry for my English.