From: Ranjeeth Dasineni <ranjeeth@fb.com>
Date: Wed, 18 Feb 2015 09:24:34 +0000 (-0800)
Subject: revert D1471958. ParseError is not intended to be caught
X-Git-Tag: v0.27.0~25
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d80b76c761f11142527175473aa70625b6413a04;p=folly.git

revert D1471958. ParseError is not intended to be caught

Summary:
a couple of files were catching this exception and included the .cpp file :O. So we moved
to .h before realizing this was not intended to be caught. reverting the move to .h. codemod will follow.

Test Plan: fbmake -r folly && fbmake && fbmake runtests

Reviewed By: delong.j@fb.com

Subscribers: trunkagent, doug, seanc, folly-diffs@, yfeldblum

FB internal diff: D1854301

Tasks: 6245781

Signature: t1:1854301:1424375745:7e226196315fac99835752896cc5e549e91df2da
---

diff --git a/folly/json.cpp b/folly/json.cpp
index d4f0771d..19e6aa0b 100644
--- a/folly/json.cpp
+++ b/folly/json.cpp
@@ -256,6 +256,26 @@ private:
   serialization_opts const& opts_;
 };
 
+  //////////////////////////////////////////////////////////////////////
+
+  struct ParseError : std::runtime_error {
+    explicit ParseError(int line)
+      : std::runtime_error(to<std::string>("json parse error on line ", line))
+    {}
+
+    explicit ParseError(int line, std::string const& context,
+        std::string const& expected)
+      : std::runtime_error(to<std::string>("json parse error on line ", line,
+          !context.empty() ? to<std::string>(" near `", context, '\'')
+                          : "",
+          ": ", expected))
+    {}
+
+    explicit ParseError(std::string const& msg)
+      : std::runtime_error("json parse error: " + msg)
+    {}
+  };
+
 // Wraps our input buffer with some helper functions.
 struct Input {
   explicit Input(StringPiece range, json::serialization_opts const* opts)
diff --git a/folly/json.h b/folly/json.h
index 458ab63a..aaf1fca1 100644
--- a/folly/json.h
+++ b/folly/json.h
@@ -51,27 +51,6 @@ namespace folly {
 
 namespace json {
 
-  //////////////////////////////////////////////////////////////////////
-
-  struct ParseError : std::runtime_error {
-    explicit ParseError(int line)
-      : std::runtime_error(to<std::string>("json parse error on line ", line))
-    {}
-
-    explicit ParseError(int line, std::string const& context,
-        std::string const& expected)
-      : std::runtime_error(to<std::string>("json parse error on line ", line,
-          !context.empty() ? to<std::string>(" near `", context, '\'')
-                          : "",
-          ": ", expected))
-    {}
-
-    explicit ParseError(std::string const& msg)
-      : std::runtime_error("json parse error: " + msg)
-    {}
-  };
-
-
   struct serialization_opts {
     explicit serialization_opts()
       : allow_non_string_keys(false)