Added new method which allows throwing exceptions inside callback API