public void HandleListItemEventException(Exception exception, SPEventPropertiesBase spItemEventProperties, ListItemAction listItemAction, string message) { try { var logger = GetLogger(exception); spItemEventProperties.Cancel = (ListItemAction.Cancel == listItemAction); spItemEventProperties.ErrorMessage = message; logger.LogToOperations(exception, defaultEventID, EventLogEntryType.Error, null); } catch (ExceptionHandlingException) { throw; } catch (Exception handlingException) { ThrowExceptionHandlingException(handlingException, exception); } }
/// <summary> /// Handle an exception in a listItemEvent. This will set the Cancel property of the <paramref name="spItemEventProperties"/> /// to true if the <paramref name="listItemAction"/> equals <see cref="ListItemAction.Cancel"/>, set the error message on /// the <paramref name="spItemEventProperties"/> and log the exception into the <see cref="ILogger"/> that's registered /// with the <see cref="SharePointServiceLocator"/>. /// </summary> /// <param name="exception">The exception to handle.</param> /// <param name="spItemEventProperties">The ItemEventProperties that will be updated.</param> /// <param name="listItemAction">Determines if the action should be canceled.</param> public void HandleListItemEventException(Exception exception, SPEventPropertiesBase spItemEventProperties, ListItemAction listItemAction) { this.HandleListItemEventException(exception, spItemEventProperties, listItemAction, exception.Message); }
/// <summary> /// Handle an exception in a listItemEvent. This will set the Cancel property of the <paramref name="spItemEventProperties"/> /// to true, set the error message on the <paramref name="spItemEventProperties"/> and log the exception into the <see cref="ILogger"/> /// that's registered with the <see cref="SharePointServiceLocator"/>. /// </summary> /// <param name="exception">The exception to handle.</param> /// <param name="spItemEventProperties">The ItemEventProperties that will be updated.</param> /// <param name="message">Custom message that will be passed to the logger and as the exceptionmessage on the <paramref name="spItemEventProperties"/></param> public void HandleListItemEventException(Exception exception, SPEventPropertiesBase spItemEventProperties, string message) { this.HandleListItemEventException(exception, spItemEventProperties, ListItemAction.Cancel, message); }