Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

Chapter 9. Error handling


Errors in Red Hat build of Rhea can be handled by intercepting named events corresponding to AMQP protocol or connection errors.

9.1. Handling connection and protocol errors

You can handle protocol-level errors by intercepting the following events:

  • connection_error
  • session_error
  • sender_error
  • receiver_error
  • protocol_error
  • error

These events are fired whenever there is an error condition with the specific object that is in the event. After calling the error handler, the corresponding <object>_close handler is also called.

The event argument has an error attribute for accessing the error object.

Example: Handling errors

container.on("error", function (event) {
    console.log("An error!", event.error);
});
Copy to Clipboard Toggle word wrap

Note

Because the close handlers are called in the event of any error, only the error itself needs to be handled within the error handler. Resource cleanup can be managed by close handlers. If there is no error handling that is specific to a particular object, it is typical to handle the general error event and not have a more specific handler.

Note

When reconnect is enabled and the remote server closes a connection with the amqp:connection:forced condition, the client does not treat it as an error and thus does not fire the connection_error event. The client instead begins the reconnection process.

Nach oben
Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Theme

© 2025 Red Hat