Fix warnings seen when compiling with gcc8.
gcc8 warns about catching a polymorphic exception classs by value, as that can discard information in derived classes. Change instances of this to instead catch the exception by const reference.
gcc8 warns about catching a polymorphic exception classs by value, as that can discard information in derived classes. Change instances of this to instead catch the exception by const reference.