Added option to throw exceptions instead of invoke failure_handler