///|
/// Errors that occur while reading or writing an RSS channel.
pub(all) suberror RssError {
  /// The underlying XML scanner rejected the document.
  Xml(err~ : @xml.XmlError)
  /// The input did not begin with an opening `` (or ``) tag.
  InvalidStartTag
  /// The end of the input was reached without finding a complete channel.
  Eof
} derive(Debug, Eq)

///|
pub impl Show for RssError with fn output(self, logger) -> Unit {
  match self {
    Xml(err~) =>
      match err {
        @xml.Syntax(pos~, msg~) =>
          logger.write_string("rss: xml syntax error at offset \{pos}: \{msg}")
      }
    InvalidStartTag =>
      logger.write_string("the input did not begin with an rss tag")
    Eof =>
      logger.write_string(
        "reached end of input without finding a complete channel",
      )
  }
}