///|
/// Errors produced while reading or validating Atom documents.
pub(all) suberror AtomError {
  /// The underlying XML scanner rejected the document.
  Xml(err~ : @xml.XmlError)
  /// The document root element was not `feed`.
  UnexpectedRoot(found~ : String)
  /// A required element is missing or empty.
  MissingElement(path~ : String)
} derive(Debug, Eq)

///|
impl Show for AtomError with fn output(self, logger) -> Unit {
  match self {
    Xml(err~) =>
      match err {
        @xml.Syntax(pos~, msg~) =>
          logger.write_string("atom: xml syntax error at offset \{pos}: \{msg}")
      }
    UnexpectedRoot(found~) =>
      logger.write_string("atom: unexpected root element <\{found}>")
    MissingElement(path~) =>
      logger.write_string("atom: missing required element <\{path}>")
  }
}