Added error handler to return exitcode to octopus