///|
/// Why a function of this package failed. The text names the property as `Owner.Name`, the type and, when there is one,
/// the value. An error of a callback or a handler is not one of these: it reaches the caller as it is. The functions of the
/// package `events` fail with these errors too.
#derive(Debug)
pub(all) suberror DependencyError {
  /// Values of two registries were used together, or a function did not get the registry of a type.
  RegistryMismatch(String)
  /// A type, a property, an event or a class handler cannot be registered, or metadata cannot be applied.
  InvalidRegistration(String)
  /// The object has had a host value already.
  HostAlreadySet(String)
  /// A value has another type than the property, or the validation of the property rejected it.
  InvalidValue(String)
  /// A read-only property was used without its key, or a key was used with another property.
  ReadOnly(String)
  /// An event was used with data of another type or without data, or on an object that is no element.
  InvalidEvent(String)
  /// The logical tree cannot be changed in this way, or not at this time.
  InvalidTreeEdit(String)
  /// The logical tree is deeper than a walk or the route of an event goes, as it is when an element is its own ancestor.
  TreeLoop(String)
  /// Changes and events caused each other until they were `nesting_limit` levels deep.
  NestingLimit(String)
}

///|
/// The description for people.
pub impl Show for DependencyError with fn output(self, logger) {
  match self {
    RegistryMismatch(text)
    | InvalidRegistration(text)
    | HostAlreadySet(text)
    | InvalidValue(text)
    | ReadOnly(text)
    | InvalidEvent(text)
    | InvalidTreeEdit(text)
    | TreeLoop(text)
    | NestingLimit(text) => logger.write_string(text)
  }
}

///|
pub extend DependencyError with Show::{to_string}