Catch exceptions and display them all at the end

Previously all we had access to was the return code of the threads, but by using shared memory we can store some of the exception details to output at the end