Este conteúdo não está disponível no idioma selecionado.

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);
});

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.

Red Hat logoGithubRedditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja oBlog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

© 2024 Red Hat, Inc.