How to use the @xmpp/xml.XMLError function in @xmpp/xml

To help you get started, we’ve selected a few @xmpp/xml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xmppjs / xmpp.js / packages / websocket / lib / FramedParser.js View on Github external
onEndElement(name) {
    const {cursor} = this
    if (name !== cursor.name) {
      // 
      this.emit('error', new XMLError(`${cursor.name} must be closed.`))
      return
    }

    if (cursor.parent) {
      this.cursor = cursor.parent
      return
    }

    if (cursor.is('open', 'urn:ietf:params:xml:ns:xmpp-framing')) {
      this.emit('start', cursor)
    } else if (cursor.is('close', 'urn:ietf:params:xml:ns:xmpp-framing')) {
      this.emit('end', cursor)
    } else {
      this.emit('element', cursor)
    }