Backport of COMETD-408 (allow more detailed error handling)

Hi Simone,

as requested the pull request for the master branch (2.6 will follow) - hope everything is ok, that was my first git/github experience...

Best Regards,
Florian