Handling and logging exception generated in registered script.