Ce contenu n'est pas disponible dans la langue sélectionnée.

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.

Retour au début
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2025 Red Hat