예제 #1
0
		/////////////////////////////////////////////////////////////////////////////

		public void MacroWarning( Notifier notifier, string fmt, params object [] args )
		{								
			// ******
			if( null == notifier ) {
				notifier = new UnknownNotifier();
			}

			// ******
			StringBuilder sb = new StringBuilder();

			sb.Append( preErrorWarningText );
			preErrorWarningText.Length = 0;

			string safeText = Helpers.SafeStringFormat( fmt, args );

			sb.AppendFormat( safeText );

			// ******
			notifier.ExecutionInfo = GetExecutionInfo( 0, sb.ToString() );

			// ******
			host.Warning( notifier, idNmpInstance + safeText );
		}
예제 #2
0
		/////////////////////////////////////////////////////////////////////////////

		public void MacroError( Notifier notifier, string fmt, params object [] args )
		{								
			// ******
			//InvocationStack iStack = InvocationStack;

			// ******
			if( null == notifier ) {
				notifier = new UnknownNotifier();
			}

			// ******
			StringBuilder sb = new StringBuilder();
			if( invocationStack.Empty ) {
				sb.AppendLine( "*** the invocation stack is empty ***" );
			}
			else {
				GenerateInvocationStackDump( sb );
			}

			// ******
			sb.Append( preErrorWarningText );
			sb.AppendLine();
			preErrorWarningText.Length = 0;


			string safeText = Helpers.SafeStringFormat( fmt, args );

			if( string.IsNullOrEmpty(fmt) && null != notifier.ExceptionToThrow ) {
				sb.Append( notifier.ExceptionToThrow.Message );
			}
			else {
				//sb.Append( Helpers.SafeStringFormat(fmt, args) );
				sb.Append( safeText );
			}

			// ******
			//notifier.ExecutionInfo = new ExecutionInfo(	0,
			//																						currentLocation.Item1,
			//																						currentLocation.Item2,
			//																						currentLocation.Item3,
			//																						sb.ToString()
			//																					);
			notifier.ExecutionInfo = GetExecutionInfo( 0, sb.ToString() );

			// ******
			if( null == notifier.ExceptionToThrow ) {
				notifier.ExceptionToThrow = new MacroErrorException( fmt, args );
			}

			// ******
			//
			// never returns;
			//
			host.Error( notifier, idNmpInstance + safeText );
		}