当node-amqp没有exception

我正在尝试使用node-amqp。

当在连接到兔子的部分抛出一个exception,我可以得到这个exception,但它永远重新启动连接到兔子。

看那个:

amqp = require("amqp") # Open a connection conn = amqp.createConnection( {url: "amqp://localhost"} , {reconnect: true}) conn.on "ready", -> console.log "Conn Ready" conn.queue "queueX", {ack:true}, (queue) -> console.log "Subscribed #{queue.name}" assdsd() #calling non-exiting method. No exception is thrown but the connection is restarted 

系统循环引发错误。 我知道这是因为{recconnect:true}。 但我希望能够自行处理例外情况。 任何想法?

我的脚本的输出是这样的:

 Conn Ready Subscribed queueX Conn Ready Subscribed queueX Conn Ready Subscribed queueX Conn Ready Subscribed queueX Conn Ready Subscribed queueX Conn Ready Subscribed queueX .... 

你可能在某个地方有一个错误,这可以帮助你

 # listen for conn errors conn.on 'error', (err) -> # print to check what went wrong console.error err.stack # exit script with error # http://nodejs.org/api/process.html#process_process_exit_code process.exit 1