Handling exception with script result