private void raiseTypeError(string message, object source, bool warning = false) { var exc = new StructuralTypeException("Type checking the data: " + message); var notification = warning ? ExceptionNotification.Warning(exc) : ExceptionNotification.Error(exc); ExceptionHandler.NotifyOrThrow(source, notification); }
private void raiseTypeError(string message, object source, bool warning = false, string location = null) { var exMessage = $"Type checking the data: {message}"; if (!string.IsNullOrEmpty(location)) { exMessage += $" (at {location})"; } var exc = new StructuralTypeException(exMessage); var notification = warning ? ExceptionNotification.Warning(exc) : ExceptionNotification.Error(exc); ExceptionHandler.NotifyOrThrow(source, notification); }
public ExceptionInterceptor(IExceptionSource source, ExceptionNotificationHandler handler, bool forward) { _source = source; _originalHandler = source.ExceptionHandler; source.ExceptionHandler = nestedHandler; _forward = forward; void nestedHandler(object s, ExceptionNotification a) { handler(s, a); if (forward) { _originalHandler.NotifyOrThrow(s, a); } } }