Issue #8756 by tuj: Added on error event