Coder Social home page Coder Social logo

Raising an exception within AMQP about amqp HOT 1 CLOSED

tmm1 avatar tmm1 commented on September 27, 2024
Raising an exception within AMQP

from amqp.

Comments (1)

botanicus avatar botanicus commented on September 27, 2024

Sriram, this is not a mailing list or IRC, please next time ask there. You can use exceptions as long as you don't have any async code in begin/rescue block. For async code, there should be an option to handle exceptions via callback. I'm not so familiar with EventMachine, but i. e. in Node.js you have code like:

fs.unlink('/tmp/hello', function (err) {
  if (err) throw err;
  console.log('successfully deleted /tmp/hello');
});

So you'll simply get an exception instance to the callback so you can handle it (so it's passed as an argument, not raised!). In EventMachine, I believe, defferable objects has #errback method, so you can do mydef.callback { # what'll happen on success } and mydef.errback { |error| # what'll happen on error }. But I don't remember exactly, check the documentation.

from amqp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.