Example #1
0
 //     INITIALIZATION
 //_________________________________________________________________________________________
 /// <summary>
 /// Creates a new derived error function.
 /// </summary>
 /// <param name="prototype"> The next object in the prototype chain. </param>
 /// <param name="type"> The type of error, e.g. Error, RangeError, etc. </param>
 internal ErrorConstructor(ObjectInstance prototype, ErrorType type)
     : base(prototype, __STUB__Construct, __STUB__Call)
 {
     // Initialize the constructor properties.
     var properties = new List<PropertyNameAndValue>(3);
     InitializeConstructorProperties(properties, type.ToString(), 1, ErrorInstance.CreatePrototype(Engine, this, type));
     FastSetProperties(properties);
 }
Example #2
0
        public void Trigger(ErrorType type, Location location, string message)
        {
            string locstring = location == null ? "" : " at " + location.ToString();

            Console.WriteLine(type.ToString() + locstring + ": " + message);

            fatalErrorOccured |= IsFatalError(type);
        }
Example #3
0
 public static void ShowError(ErrorType et)
 {
     MessageBox.Show(Type.GetType("OES.Error.ErrorTable").GetField(et.ToString()).GetValue(null).ToString());
     //switch (et)
     //{
     //    case ErrorType.LoginNoPersonError:
     //        MessageBox.Show(ErrorTable.LoginNoPersonError);
     //        break;
     //    case ErrorType.RARNotExist:
     //        MessageBox.Show(ErrorTable.RARNotExist);
     //        break;
     //}
 }
Example #4
0
        /// <summary>
        /// Throws an error with the given <see cref="ErrorType"/> and error message.
        /// </summary>
        public SObject ThrowError(ErrorType errorType, string message, params object[] messageArgs)
        {
            var strErrorType = errorType.ToString();
            var formattedMessage = string.Format(message, messageArgs);

            var errorObject = _processor.Context.CreateInstance("Error", new SObject[] { _processor.CreateString(formattedMessage),
                                                                                         _processor.CreateString(errorType.ToString()),
                                                                                         _processor.CreateNumber(_processor.GetLineNumber()) });

            return ThrowError(errorObject);
        }
Example #5
0
        public static string GetEnumDescription(ErrorType value)
        {
            Type type = typeof(ErrorType);

            System.Reflection.FieldInfo [] fis = type.GetFields();
            foreach(System.Reflection.FieldInfo fi in fis) 
            {
                if (fi.Name == value.ToString())
                {
                    XmlEnumAttribute[] attributes = (XmlEnumAttribute[]) fi.GetCustomAttributes(typeof(XmlEnumAttribute), false);
                    foreach (XmlEnumAttribute attr in attributes)
                    {
                        return attr.Name;
                    }
                }
            }
            return null;
        }
Example #6
0
 protected void AddModelError(ErrorType type, string msgFormat, params object[] obj)
 {
     string message = string.Format(msgFormat, obj);
     ModelState.AddModelError(type.ToString(), string.Format("{0}, {1}", ErrorInfoHelper.Instance[type], message));
 }
Example #7
0
 protected void AddModelError(ErrorType type)
 {
     ModelState.AddModelError(type.ToString(), ErrorInfoHelper.Instance[type]);
 }
Example #8
0
 private void sendAuthError(ErrorType errorType, AuthentificationException e)
 {
     Message reply = new Message(new Header("Server", MessageType.ERROR), errorType.ToString() + ";" + e.login);
     sendMessage(reply);
 }
Example #9
0
        /// <summary>
        /// Throws an error with the given <see cref="ErrorType"/> and error message.
        /// </summary>
        public SObject ThrowError(ErrorType errorType, string message)
        {
            string strErrorType = errorType.ToString();

            //TODO: Create error object here and put it as argument in the method call.
            
            return ThrowError(null);
        }
Example #10
0
 private void w_OnError(Exception ex, ErrorType errorType, string curUrl)
 {
     MessageBox.Show("采集发送错误,错误类型:" + errorType.ToString() + "详情:\n" + StringFormat.FormatExceptionString(ex), "网络采集器", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
Example #11
0
 /// <summary>
 /// Creates the Error prototype object.
 /// </summary>
 /// <param name="engine"> The script environment. </param>
 /// <param name="constructor"> A reference to the constructor that owns the prototype. </param>
 /// <param name="type"> The type of error, e.g. Error, RangeError, etc. </param>
 internal static ObjectInstance CreatePrototype(ScriptEngine engine, ErrorConstructor constructor, ErrorType type)
 {
     var result = CreateRawObject(GetPrototype(engine, type));
     var properties = GetDeclarativeProperties(engine);
     properties.Add(new PropertyNameAndValue("constructor", constructor, PropertyAttributes.NonEnumerable));
     properties.Add(new PropertyNameAndValue("name", type.ToString(), PropertyAttributes.NonEnumerable));
     properties.Add(new PropertyNameAndValue("message", string.Empty, PropertyAttributes.NonEnumerable));
     result.FastSetProperties(properties);
     return result;
 }
Example #12
0
		protected virtual void OnLog(string Message, ErrorType ErrorType, ErrorOrigin origin)
		{
			var icon = MessageBoxIcon.Error;
			if (ErrorType==ErrorType.Warning)
				icon = MessageBoxIcon.Warning;
			else if (ErrorType==ErrorType.Information || ErrorType==ErrorType.Message)
				icon = MessageBoxIcon.Information;

			MessageBox.Show(Message,origin.ToString() +" "+ ErrorType.ToString(),MessageBoxButtons.OK,icon);

			try
			{
				if (origin == ErrorOrigin.System)
					File.AppendAllText(IDEInterface.ConfigDirectory + "\\sys.log", Message + "\r\n", System.Text.Encoding.Unicode);
			}
			catch { }
		}