#2757 Support flowing causation error to disconnect error handler in JS client

Rebased on the latest dev.