Improve error handling on algorithm local execution
Currently, when an error occurred in one of the scripts, it could just hang or the error itself wasn't properly processed.
This patch improves exception handling as well as error message returned.