コード例 #1
0
        internal static SimObjectError createError(Behavior behavior, Exception e)
        {
            var error = new SimObjectError()
            {
                Subsystem = "Behavior",
                Message   = e.Message
            };

            error.ElementName = behavior.Name;
            error.SimObject   = behavior.Owner != null ? behavior.Owner.Name : "NullSimObject";
            error.Type        = behavior.GetType().Name;

            return(error);
        }
コード例 #2
0
        internal static SimObjectError createError(BehaviorFactoryEntry entry, Exception e)
        {
            var error = new SimObjectError()
            {
                Subsystem = "Behavior",
                Message   = e.Message
            };

            if (entry.CreatedBehavior != null)
            {
                error.ElementName = entry.CreatedBehavior.Name;
                error.SimObject   = entry.CreatedBehavior.Owner != null ? entry.CreatedBehavior.Owner.Name : "NullSimObject";
                error.Type        = entry.CreatedBehavior.GetType().Name;
            }
            else
            {
                error.ElementName = "UnknownName";
                error.SimObject   = "UnknownSimObject";
                error.Type        = "UnknownType";
            }

            return(error);
        }
コード例 #3
0
 public static void AddAndLogError(SimObjectError error, LogLevel logLevel = LogLevel.Warning)
 {
     AddError(error);
     Log.Default.sendMessage("Error creating {0} named '{1}' in SimObject '{2}'. Reason: {3}", logLevel, error.Subsystem, error.Type, error.ElementName, error.SimObject, error.Message);
 }
コード例 #4
0
 /// <summary>
 /// Add an error to the repository.
 /// </summary>
 /// <param name="error">The error to add.</param>
 public static void AddError(SimObjectError error)
 {
     errors.AddLast(error);
 }