(no ticket) catch exception by ref
Patch: Gaurav Singh

This closes #1998
diff --git a/compiler/cpp/src/thrift/main.cc b/compiler/cpp/src/thrift/main.cc
index 03e0d6f..4c900f7 100644
--- a/compiler/cpp/src/thrift/main.cc
+++ b/compiler/cpp/src/thrift/main.cc
@@ -932,7 +932,7 @@
     if (yyparse() != 0) {
       failure("Parser error during include pass.");
     }
-  } catch (string x) {
+  } catch (string &x) {
     failure(x.c_str());
   }
   fclose(yyin);
@@ -970,7 +970,7 @@
     if (yyparse() != 0) {
       failure("Parser error during types pass.");
     }
-  } catch (string x) {
+  } catch (string &x) {
     failure(x.c_str());
   }
   fclose(yyin);
@@ -1014,7 +1014,7 @@
         delete generator;
       }
     }
-  } catch (string s) {
+  } catch (string &s) {
     failure("Error: %s\n", s.c_str());
   } catch (const char* exc) {
     failure("Error: %s\n", exc);