Beispiel #1
0
        private static string HumanReadableMessage(object instance, LifecycleStatus from, LifecycleStatus to, Exception cause)
        {
            string        instanceStr = instance.ToString();
            StringBuilder message     = new StringBuilder();

            switch (to)
            {
            case Org.Neo4j.Kernel.Lifecycle.LifecycleStatus.Stopped:
                if (from == LifecycleStatus.None)
                {
                    message.Append("Component '").Append(instanceStr).Append("' failed to initialize");
                }
                else if (from == LifecycleStatus.Started)
                {
                    message.Append("Component '").Append(instanceStr).Append("' failed to stop");
                }
                break;

            case Org.Neo4j.Kernel.Lifecycle.LifecycleStatus.Started:
                if (from == LifecycleStatus.Stopped)
                {
                    message.Append("Component '").Append(instanceStr).Append("' was successfully initialized, but failed to start");
                }
                break;

            case Org.Neo4j.Kernel.Lifecycle.LifecycleStatus.Shutdown:
                message.Append("Component '").Append(instanceStr).Append("' failed to shut down");
                break;

            default:
                break;
            }
            if (message.Length == 0)
            {
                message.Append("Component '").Append(instanceStr).Append("' failed to transition from ").Append(from.name().ToLower()).Append(" to ").Append(to.name().ToLower());
            }
            message.Append('.');
            if (cause != null)
            {
                Exception root = RootCause(cause);
                message.Append(" Please see the attached cause exception \"").Append(root.Message).Append('"');
                if (root.InnerException != null)
                {
                    message.Append(" (root cause cycle detected)");
                }
                message.Append('.');
            }

            return(message.ToString());
        }
Beispiel #2
0
 public override string ToString()
 {
     return(Instance.ToString() + ": " + CurrentStatus.name());
 }