Maybe due to our configuration (maybe due to M2), error messages are not printed anymore in Onepage checkout.
- It's a simple case of throwing a
capture()for reason X. That results in a 400 response for the
/V1/carts/mine/payment-informationrequest. All good.
- M2 creates a JSON out of that exception, with a
messageproperty, which is then handled here. Superb.
- The error message is then pushed onto an error message container here. Omg, brilliant.
- Then nothing happens, what.
I was expecting the error message to be printed. Mind you, the above behaviour was tracked down with a JS debugger, I'm not assuming it happens.
Trying to fix this, I've stumbled upon
\Magento\Framework\Message\ManagerInterface. Using that in my
capture() method, it correctly added another message which this time was fetched with that
customer/section/load request I dearly hate. And, although the
messages property of the response was what I wanted, I still couldn't see my message appear.
If I put back that message block, the message is finally showing, hooray. But I don't think M2 devs removed that block by mistake.
Do any of you know how exactly the JS message container does its job? Who triggers its rendering?