Hi,
For AJAX debugging, the simplest is to echo your debug and finish with "exit;". Then, before you do the AJAX action in your browser, open the browser console and make sure that the "network" tab is activated.
Then, do the action and in the network tab, you'll see the AJAX request being sent and if you open it, you can access the response. There, you'll get your debug.
This works for HikaShop's AJAX but it will work for any kind of AJAX process anywhere so it's a good thing to know.
To display the error, what you can do is this:
$cartClass = hikashop_get('class.cart');
$cartClass->addMessage($cart, array('msg'=>'My error message', 'type' => 'error'));
That way, when the system will display your message as a notification box on the page.