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); }
internal bool MustSerializeMember(ITypedElement source, out IElementDefinitionSummary info) { info = source.Definition; if (info == null && !_roundtripMode) { var message = $"Element '{source.Location}' is missing type information."; if (_settings.IgnoreUnknownElements) { ExceptionHandler.NotifyOrThrow(source, ExceptionNotification.Warning( new MissingTypeInformationException(message))); } else { ExceptionHandler.NotifyOrThrow(source, ExceptionNotification.Error( new MissingTypeInformationException(message))); } return(false); } return(true); }