RabbitMQ/AMQP: How to see errors if a message is not routed? mantatory: true seems not to work?

Is there a way to tell if a message you publish is being dropped or otherwise not being routed? E.g. if I publish something to a headers exchange, but the message lacks the proper headers so it doesn’t match any bindings?

The mandatory: true seemed promising… a warning is logged and I can see that there was some trouble with the message, but the return value was still :ok:

iex> {:ok, connection} = AMQP.Connection.open([])
iex> {:ok, channel} = AMQP.Channel.open(connection)
iex> AMQP.Basic.publish(channel, "headers_exchange", "", "hello?", mandatory: true)

{:P_basic, :undefined, :undefined, :undefined, 1, :undefined, :undefined,
  :undefined, :undefined, :undefined, :undefined, :undefined, :undefined,
  :undefined, :undefined}, "hello?"}} but there is no return handler registered

It’s a similar result if I try publishing to a direct exchange and route to a queue that does not exist, e.g.

AMQP.Basic.publish(channel, "", "does-not-exist", "hello?", mandatory: true)

I tried the immediate: true option, but according to the return value, everything was :ok, not an error that I was expecting.

Am I doing something wrong or misunderstanding how this is supposed to work?